wifi:Fix the crash issue when restarting the wpa_supplicant or wifi driver while BackgroundScanning is enable
PATCH 1/1 wifi:Fix the crash issue when restarting the wpa_supplicant or wifi driver while BackgroundScanning is enable
If BackgroundScanning is enable, passive auto scanning timeout work need to be removed when a new active scanning is triggered.Because wifi->autoscan and auto scanning timeout work will be receated for new active scanning, but old passive auto scanning timeout work is still running, if wifi firmware or wpa_supplicant is restarted at some time in the future, old wifi and autoscan objects pointers will be freed, so wifi and wifi->autoscan objects pointers will be dangling pointers when the timeout handler function of old passive scanning work will obtain wifi and wifi->autoscan objects, it will trigger a crash of connman.
--- plugins/wifi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
plugins/wifi.c +16 -4
@@ -1999,13 +1999,25 @@ static int wifi_scan(struct connman_device *device, } } +/* +* If BackgroundScanning is enable, passive auto scanning timeout work need to +* be removed when a new active scanning is triggered.Because wifi->autoscan +* and auto scanning timeout work will be receated for new active scanning, but +* old passive auto scanning timeout work is still running, if wifi firmware or +* wpa_supplicant is restarted at some time in the future, old wifi and autoscan +* objects pointers will be freed, so wifi and wifi->autoscan objects pointers will +* be dangling pointers when the timeout handler function of old passive scanning +* work will obtain wifi and wifi->autoscan objects, it will trigger a crash of connman. +*/ +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
Hi
Some nit, try to reduce the subject of the patch to < 80 chars, for rendering problem
Quoted 9 lines · yaming.chen
If BackgroundScanning is enable, passive auto scanning timeout work need to be removed when a new active scanning is triggered.Because
wifi->autoscanand auto scanning timeout work will be receated for new active scanning, but old passive auto scanning timeout work is still running, if wifi firmware orwpa_supplicantis restarted at some time in the future, old wifi and autoscan objects pointers will be freed, so wifi andwifi->autoscanobjects pointers will be dangling pointers when the timeout handler function of old passive scanning work will obtain wifi andwifi->autoscanobjects, it will trigger a crash of connman.
Quoted 4 lines
--- plugins/wifi.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-)
Quoted 37 lines
plugins/wifi.c +16
-5@@ -1999,13 +1999,25 @@ static int wifi_scan(struct connman_device *device, } } +/* +* If BackgroundScanning is enable, passive auto scanning timeout work need to +* be removed when a new active scanning is triggered.Because wifi->autoscan +* and auto scanning timeout work will be receated for new active scanning, but +* old passive auto scanning timeout work is still running, if wifi firmware or +* wpa_supplicant is restarted at some time in the future, old wifi and autoscan +* objects pointers will be freed, so wifi and wifi->autoscan objects pointers will +* be dangling pointers when the timeout handler function of old passive scanning +* work will obtain wifi and wifi->autoscan objects, it will trigger a crash of connman. +*/ +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