All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] plugins/wifi: Fix GSupplicantInterface socket leak on out-of-band drop
@ 2026-08-16 16:21 kasuta
  0 siblings, 0 replies; only message in thread
From: kasuta @ 2026-08-16 16:21 UTC (permalink / raw)
  To: connman

When an unmanaged or virtual interface changes state or drops, 
interface_removed() is invoked within the wireless event pathways. 

If wifi or wifi->device has already been cleared or unlinked during the 
topology shift, the function triggers an early return. This conditional
block accidentally bypasses the mandatory
g_supplicant_interface_cancel()
and data unreferencing routines. As a result, low-level netlink and
event 
file descriptors are permanently leaked in the process table.

Refactor interface_removed() to ensure that the core supplicant 
interface resource cancellation runs unconditionally before releasing
control.

Signed-off-by: Doemela <kasuta@riseup.net>
---
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 9ce7b5a..bcf8321 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -1014,14 +1014,16 @@ static void
interface_removed(GSupplicantInterface *interface)
 	wifi = g_supplicant_interface_get_data(interface);
 
 	if (wifi != NULL && wifi->tethering == TRUE)
 		return;
 
-	if (wifi == NULL || wifi->device == NULL) {
-		DBG("wifi interface already removed");
-		return;
-	}
+	if (wifi != NULL && wifi->device != NULL) {
+		wifi->interface = NULL;
+		connman_device_set_powered(wifi->device, FALSE);
+	} else {
+		DBG("wifi device linkage missing, executing isolated interface
cleanup");
+	}
 
-	wifi->interface = NULL;
-	connman_device_set_powered(wifi->device, FALSE);
+	g_supplicant_interface_set_data(interface, NULL);
+	g_supplicant_interface_cancel(interface);
 }

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-08-16 16:21 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-16 16:21 [PATCH] plugins/wifi: Fix GSupplicantInterface socket leak on out-of-band drop kasuta

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.