Skip to contentSkip to conversation

wifi:Remove passive scan on new active scan

PATCH In review yaming.chen 2 participants 2 messages Jan 14

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 wifi:Remove passive scan on new active scan

If BackgroundScanning is enable, the old passive scanning task needs to be removed when the new active scanning is triggered. It can prevent the old passive scan timeout handler function from accessing the dangling pointer after restarting the wpa_supplicant and wifi driver.

---
Changes since v2:
- Remove the change log of the patch file from subject

---
 plugins/wifi.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
plugins/wifi.c +13 -4
index 12389fa6..96c0c127 100644
@@ -1999,13 +1999,22 @@ static int wifi_scan(struct connman_device *device,
 		}
 	}
 
+	/*
+	 * If BackgroundScanning is enable, the old passive scanning task
+	 * needs to be removed when the new active scanning is triggered.
+	 * It can prevent the old passive scan timeout handler function
+	 * from accessing the dangling pointer after restarting the
+	 * wpa_supplicant and wifi driver.
+	 */
+	if (connman_setting_get_bool("BackgroundScanning") ||
+			wifi->scanning_type != WIFI_SCANNING_PASSIVE) {
+		connman_device_ref(device);
+		reset_autoscan(device);
+	}
+
 	/* Distinguish between devices performing passive and active scanning */
 	wifi_update_scanner_type(wifi, WIFI_SCANNING_ACTIVE);
 
-	connman_device_ref(device);
-
-	reset_autoscan(device);
-
 	ret = g_supplicant_interface_scan(wifi->interface, scan_params,
 						scan_callback, device);
 	if (ret == 0) {
Signature · 1 line
2.34.1
#1 lore raw

Hi

Quoted 11 lines · yaming.chen

If BackgroundScanning is enable, the old passive scanning task needs to be removed when the new active scanning is triggered. It can prevent the old passive scan timeout handler function from accessing the dangling pointer after restarting the wpa_supplicant and wifi driver.

---
Changes since v2:
- Remove the change log of the patch file from subject

Thank you for your cooperation ;)

Michael

Quoted 38 lines
---
 plugins/wifi.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)
plugins/wifi.c +13 -5
index 12389fa6..96c0c127 100644
@@ -1999,13 +1999,22 @@ static int wifi_scan(struct connman_device *device,
                }
        }
 
+       /*
+        * If BackgroundScanning is enable, the old passive scanning task
+        * needs to be removed when the new active scanning is triggered.
+        * It can prevent the old passive scan timeout handler function
+        * from accessing the dangling pointer after restarting the
+        * wpa_supplicant and wifi driver.
+        */
+       if (connman_setting_get_bool("BackgroundScanning") ||
+                       wifi->scanning_type != WIFI_SCANNING_PASSIVE) {
+               connman_device_ref(device);
+               reset_autoscan(device);
+       }
+
        /* Distinguish between devices performing passive and active scanning */
        wifi_update_scanner_type(wifi, WIFI_SCANNING_ACTIVE);
 
-       connman_device_ref(device);
-
-       reset_autoscan(device);
-
        ret = g_supplicant_interface_scan(wifi->interface, scan_params,
                                                scan_callback, device);
        if (ret == 0) {
--

2.34.1

Signature · 11 lines
Michael Nazzareno Trimarchi
Co-Founder & Chief Executive Officer
M. +39 347 913 2170
[email protected]
__________________________________

Amarula Solutions BV
Joop Geesinkweg 125, 1114 AB, Amsterdam, NL
T. +31 (0)85 111 9172
[email protected]
www.amarulasolutions.com