brcmfmac: fix potential NULL pointer dereference in brcmf_fws_flow_control_check()
authorWei Yongjun <yongjun_wei@trendmicro.com.cn>
Fri, 19 Apr 2013 02:14:31 +0000 (10:14 +0800)
committerJohn W. Linville <linville@tuxdriver.com>
Mon, 22 Apr 2013 19:20:25 +0000 (15:20 -0400)
The dereference to 'ifp' in debug code should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
Acked-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c

index 8ae7da8bf688e9954eac4df1036623699bbbf01a..66cdc45add4e9c7851c549eed417fafcbb073a43 100644 (file)
@@ -834,11 +834,12 @@ brcmf_fws_flow_control_check(struct brcmf_fws_info *fws, struct pktq *pq,
 {
        struct brcmf_if *ifp = fws->drvr->iflist[if_id];
 
-       brcmf_dbg(TRACE,
-                 "enter: bssidx=%d, ifidx=%d\n", ifp->bssidx, ifp->ifidx);
        if (WARN_ON(!ifp))
                return;
 
+       brcmf_dbg(TRACE,
+                 "enter: bssidx=%d, ifidx=%d\n", ifp->bssidx, ifp->ifidx);
+
        if ((ifp->netif_stop & BRCMF_NETIF_STOP_REASON_FWS_FC) &&
            pq->len <= BRCMF_FWS_FLOWCONTROL_LOWATER)
                brcmf_txflowblock_if(ifp,