nl80211: Fix RTM event handling for dynamic interfaces

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>
This commit is contained in:
Andrei Otcheretianski 2014-03-03 14:53:19 +02:00 committed by Jouni Malinen
parent 54ac5aa271
commit 819f096f5b

View 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;
}
}