From: Jukka Rissanen Date: Fri, 25 Nov 2011 15:06:16 +0000 (+0200) Subject: wifi: The remove interface callback used stale pointer. X-Git-Tag: 2.0_alpha~898 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=80e2e08b4887c4e133d3ca7d42ac844fbb974bb8;p=framework%2Fconnectivity%2Fconnman.git wifi: The remove interface callback used stale pointer. When a wlan interface is removed we call proper method in supplicant dbus interface. As the return message from supplicant might come very late, we must not use the wifi pointer as user data in interface remove callback. This is because the wifi pointer might be removed before the answer comes from supplicant and the callback user data pointer would not be valid at that point. --- diff --git a/plugins/wifi.c b/plugins/wifi.c index 2fe1479..2070bb9 100644 --- a/plugins/wifi.c +++ b/plugins/wifi.c @@ -219,7 +219,9 @@ static void interface_remove_callback(int result, GSupplicantInterface *interface, void *user_data) { - struct wifi_data *wifi = user_data; + struct wifi_data *wifi; + + wifi = g_supplicant_interface_get_data(interface); DBG("result %d wifi %p", result, wifi); @@ -265,7 +267,7 @@ static int wifi_disable(struct connman_device *device) ret = g_supplicant_interface_remove(wifi->interface, interface_remove_callback, - wifi); + NULL); if (ret < 0) return ret;