From: Hante Meuleman Date: Thu, 15 Nov 2012 02:46:13 +0000 (-0800) Subject: brcmfmac: fix NULL pointer access in brcmf_fweh_detach() X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=df19e777e0587004bb926c73c7188e0d63f19372;p=linux-beck.git brcmfmac: fix NULL pointer access in brcmf_fweh_detach() brcmf_fweh_detach can be called while ifp is already NULL, due to init error. Fix NULL pointer access by checking ifp. Reviewed-by: Arend Van Spriel Signed-off-by: Hante Meuleman Signed-off-by: Franky Lin Signed-off-by: John W. Linville --- diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c index e1521afe6522..283acee1798b 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fweh.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fweh.c @@ -374,11 +374,13 @@ void brcmf_fweh_detach(struct brcmf_pub *drvr) struct brcmf_if *ifp = drvr->iflist[0]; s8 eventmask[BRCMF_EVENTING_MASK_LEN]; - /* clear all events */ - memset(eventmask, 0, BRCMF_EVENTING_MASK_LEN); - (void)brcmf_fil_iovar_data_set(ifp, "event_msgs", - eventmask, BRCMF_EVENTING_MASK_LEN); - + if (ifp) { + /* clear all events */ + memset(eventmask, 0, BRCMF_EVENTING_MASK_LEN); + (void)brcmf_fil_iovar_data_set(ifp, "event_msgs", + eventmask, + BRCMF_EVENTING_MASK_LEN); + } /* cancel the worker */ cancel_work_sync(&fweh->event_work); WARN_ON(!list_empty(&fweh->event_q));