summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHante Meuleman <meuleman@broadcom.com>2012-11-15 06:46:13 +0400
committerJohn W. Linville <linville@tuxdriver.com>2012-11-16 23:28:54 +0400
commitdf19e777e0587004bb926c73c7188e0d63f19372 (patch)
tree7cdeb9c2f745525d014b4dc6ff9bc8b1efe565ed
parent0b63cb71f1e6b74a6f68a9c7b10d823fd9914d0a (diff)
downloadlinux-df19e777e0587004bb926c73c7188e0d63f19372.tar.xz
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 <arend@broadcom.com> Signed-off-by: Hante Meuleman <meuleman@broadcom.com> Signed-off-by: Franky Lin <frankyl@broadcom.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/fweh.c12
1 files changed, 7 insertions, 5 deletions
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));