wifi: Handle D-Bus method call failure
authorPatrik Flykt <patrik.flykt@linux.intel.com>
Fri, 9 Nov 2012 08:54:21 +0000 (10:54 +0200)
committerPatrik Flykt <patrik.flykt@linux.intel.com>
Tue, 13 Nov 2012 12:37:59 +0000 (14:37 +0200)
If -ECONNABORTED is received from the gsupplicant network disconnect
callback, it's an indication that the interface has already been
removed from wpa_supplicant side. This can happen due to a race condition
between rtnl and wpa_supplicant interface removal when a USB WiFi dongle
is pulled out.

The pointers given to the callback can no longer be trusted, don't touch
them in the callback. The have been removed by other code at this point.

plugins/wifi.c

index d2ab3b0..1e9d28c 100644 (file)
@@ -1238,6 +1238,14 @@ static void disconnect_callback(int result, GSupplicantInterface *interface,
 {
        struct wifi_data *wifi = user_data;
 
+       DBG("result %d supplicant interface %p wifi %p",
+                       result, interface, wifi);
+
+       if (result == -ECONNABORTED) {
+               DBG("wifi interface no longer available");
+               return;
+       }
+
        if (wifi->network != NULL) {
                /*
                 * if result < 0 supplican return an error because