diff options
author | Thomas Haller <thaller@redhat.com> | 2016-01-21 15:03:44 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-01-21 15:05:03 +0100 |
commit | bd27102277e5d7e52d87bd26711ae6c431e08192 (patch) | |
tree | 8877c85c7471353fe5a6a0c88202851ce3969a0c | |
parent | 69e8b4678d9ca166a1929d976cec1fabdb8fc5d4 (diff) | |
download | NetworkManager-bd27102277e5d7e52d87bd26711ae6c431e08192.tar.gz |
wifi: assert against returning cached NMSupplicantInterface instances
nm_supplicant_manager_iface_get() returning a cached instance leads to
a crash when the first owner releases the object, as no ownership is
transferred.
That was fixed on master by commit f1fba3eb02c5d102a1b0e85c371dce81e5bd0d3b.
Instead of backporting the entire refactoring (which also asserts against
reuse), just disallow reusing here.
The assertion should not be hit. If it would we need to investigate.
Also, this way the assertion avoids a hard crash.
https://bugzilla.redhat.com/show_bug.cgi?id=1298007
-rw-r--r-- | src/supplicant-manager/nm-supplicant-manager.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c index 083f2ebcb7..e31e726a25 100644 --- a/src/supplicant-manager/nm-supplicant-manager.c +++ b/src/supplicant-manager/nm-supplicant-manager.c @@ -93,7 +93,10 @@ nm_supplicant_manager_iface_get (NMSupplicantManager * self, iface); } } else { - nm_log_dbg (LOGD_SUPPLICANT, "(%s): returning existing supplicant interface", ifname); + /* nm_supplicant_manager_iface_get() and release() implements no form of ref-counting + * to properly handle reusing a cached instance. It's also unclear whether that is + * even necessary or desired. Assert here and error out (rh #1298007). */ + g_return_val_if_reached (NULL); } return iface; |