[PATCH v4] plugins/wifi: Fix GSupplicantInterface socket leak during teardown
Doemela <[email protected]>
| Newsgroups | dev.linux.lists.connman |
|---|---|
| Message-ID | <[email protected]> |
During interface teardown, the GSupplicantInterface resources were not being
properly canceled, leading to a socket file descriptor leak. This patch
ensures that g_supplicant_interface_cancel is executed safely when the
interface is removed.
---
Changes in v4:
- Restored the missing patch commit description text.
- Fixed the stray empty line deletion formatting error.
Changes in v3:
- Fixed a text truncation error that broke the v2 patch file structure.
- Switched entirely to using git send-email to prevent browser text corruption.
- Sorry about the email formatting noise; it has been a long time since I used an email mailing list!
Changes in v2:
- Corrected resource cancellation paths inside GSupplicantInterface.
plugins/wifi.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/plugins/wifi.c b/plugins/wifi.c
index 9ce7b5a3..ce09b556 100644
--- a/plugins/wifi.c
+++ b/plugins/wifi.c
@@ -2740,19 +2740,17 @@ static void interface_removed(GSupplicantInterface *interface)
DBG("ifname %s", ifname);
wifi = g_supplicant_interface_get_data(interface);
-
if (wifi)
wifi->interface = NULL;
if (wifi && wifi->tethering)
return;
- if (!wifi || !wifi->device) {
- DBG("wifi interface already removed");
- return;
- }
+ if (wifi != NULL && wifi->device != NULL)
+ connman_device_set_powered(wifi->device, FALSE);
- connman_device_set_powered(wifi->device, false);
+ g_supplicant_interface_set_data(interface, NULL);
+ g_supplicant_interface_cancel(interface);
check_p2p_technology();
}
--
2.47.3