NetworkManager/0002-wifi-avoid-crash-reusi...

43 lines
1.7 KiB
Diff

From dd8ee9be472ddf799e63e035bf0c82f072dc1881 Mon Sep 17 00:00:00 2001
From: Thomas Haller <thaller@redhat.com>
Date: Thu, 21 Jan 2016 15:03:44 +0100
Subject: [PATCH 1/1] 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
(cherry picked from commit bd27102277e5d7e52d87bd26711ae6c431e08192)
---
src/supplicant-manager/nm-supplicant-manager.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/supplicant-manager/nm-supplicant-manager.c b/src/supplicant-manager/nm-supplicant-manager.c
index 083f2eb..e31e726 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;
--
2.5.0