diff options
author | Yu A Wang <arron.wang@intel.com> | 2011-12-21 02:14:58 -0500 |
---|---|---|
committer | Daniel Wagner <daniel.wagner@bmw-carit.de> | 2012-01-05 10:50:45 +0100 |
commit | ae574c8863e8c908791697c927b69c9bc0bbdadf (patch) | |
tree | c03b42c28539297e1a2942ba45db5c12980cfad2 /plugins | |
parent | 3f3a5b5d99080f32112c8bcec32ad4f8421d6459 (diff) | |
download | connman-ae574c8863e8c908791697c927b69c9bc0bbdadf.tar.gz connman-ae574c8863e8c908791697c927b69c9bc0bbdadf.tar.bz2 connman-ae574c8863e8c908791697c927b69c9bc0bbdadf.zip |
wifi: Set interface to NULL in interface_removed
Currently we set wifi interface to NULL in interface_remove_callback.
commit 80e2e08b4887c4e133d3ca7d42ac844fbb974bb8 avoid to use stale
pointer by get wifi pointer through interface, but interface already
removed and should be NULL, then the interface value in wifi will never
set to NULL and will be a wild pointer. Which may cause connman crash
when we connect wifi service after we disable the wifi. This issue does
not exist in latest connman due to connect-service method is removed.
we can set wifi interface in interface_removed which called in remove_interface
in supplicant.c, because after interface is freed in supplicant, we should not
hold this pointer anymore.
Fixes BMC#24364
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/wifi.c | 22 |
1 files changed, 2 insertions, 20 deletions
diff --git a/plugins/wifi.c b/plugins/wifi.c index 5f41b25b..0860938e 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -236,23 +236,6 @@ static void interface_create_callback(int result, connman_device_set_powered(wifi->device, TRUE); } -static void interface_remove_callback(int result, - GSupplicantInterface *interface, - void *user_data) -{ - struct wifi_data *wifi; - - wifi = g_supplicant_interface_get_data(interface); - - DBG("result %d wifi %p", result, wifi); - - if (result < 0 || wifi == NULL) - return; - - wifi->interface = NULL; -} - - static int wifi_enable(struct connman_device *device) { struct wifi_data *wifi = connman_device_get_data(device); @@ -286,9 +269,7 @@ static int wifi_disable(struct connman_device *device) remove_networks(device, wifi); - ret = g_supplicant_interface_remove(wifi->interface, - interface_remove_callback, - NULL); + ret = g_supplicant_interface_remove(wifi->interface, NULL, NULL); if (ret < 0) return ret; @@ -1100,6 +1081,7 @@ static void interface_removed(GSupplicantInterface *interface) return; } + wifi->interface = NULL; connman_device_set_powered(wifi->device, FALSE); } |