From: kasuta@riseup.net
To: connman@lists.linux.dev
Subject: [PATCH] plugins/wifi: Fix GSupplicantInterface socket leak on out-of-band drop
Date: Sun, 16 Aug 2026 16:21:22 +0000 [thread overview]
Message-ID: <3dc118dce9fca530fffff07dbee1265f@riseup.net> (raw)
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);
}
reply other threads:[~2026-08-16 16:21 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3dc118dce9fca530fffff07dbee1265f@riseup.net \
--to=kasuta@riseup.net \
--cc=connman@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.