From: Andrei Otcheretianski Date: Mon, 3 Mar 2014 12:53:19 +0000 (+0200) Subject: nl80211: Fix RTM event handling for dynamic interfaces X-Git-Tag: hostap_2_2~673 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=819f096f5bc632174a0bac73d862830fe124dcf6;p=thirdparty%2Fhostap.git 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 --- diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 5439f81c4..7468e5d19 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -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; } }