nl80211: Fix RTM event handling for dynamic interfaces
authorAndrei Otcheretianski <andrei.otcheretianski@intel.com>
Mon, 3 Mar 2014 12:53:19 +0000 (14:53 +0200)
committerJouni Malinen <j@w1.fi>
Tue, 4 Mar 2014 20:30:48 +0000 (22:30 +0200)
When an interface is disabled through rtm event, wpa_supplicant's
EVENT_INTERFACE_DISABLED is generated, which in turn, may
completely destroy wpa_driver_nl80211_data struct (drv). This
scenario happens now when P2P GO interface is disabled. Since this
struct may be used later in this function it causes segmentation fault.

Fix it by trying to find drv again in the interface list after
wpa_supplicant's event handling.

Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@intel.com>
src/drivers/driver_nl80211.c

index 5439f81..7468e5d 100644 (file)
@@ -1239,6 +1239,16 @@ static void wpa_driver_nl80211_event_rtm_newlink(void *ctx,
                        drv->if_disabled = 1;
                        wpa_supplicant_event(drv->ctx,
                                             EVENT_INTERFACE_DISABLED, NULL);
+
+                       /*
+                        * Try to get drv again, since it may be removed as
+                        * part of the EVENT_INTERFACE_DISABLED handling for
+                        * dynamic interfaces
+                        */
+                       drv = nl80211_find_drv(global, ifi->ifi_index,
+                                              buf, len);
+                       if (!drv)
+                               return;
                }
        }