From patchwork Fri Apr 19 02:14:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 2463011 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id C77EF3FD8C for ; Fri, 19 Apr 2013 02:14:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967789Ab3DSCOd (ORCPT ); Thu, 18 Apr 2013 22:14:33 -0400 Received: from mail-bk0-f51.google.com ([209.85.214.51]:47287 "EHLO mail-bk0-f51.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S967698Ab3DSCOc (ORCPT ); Thu, 18 Apr 2013 22:14:32 -0400 Received: by mail-bk0-f51.google.com with SMTP id y8so1550208bkt.10 for ; Thu, 18 Apr 2013 19:14:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:date:message-id:subject:from:to:cc :content-type; bh=F9TuTocqlE6bM5haDoiBemDbE64RZ+FueHcuQkLrf6w=; b=dr5DQRCTVL1BQllyTY0iJlnazbcUAkN1bwCIqWjdaHAarzg0TY+5/K88yPsqI00nK4 1K0i4DF3Ofqca05XEtyPHqZ4I3TTHIXANt8VmtnEsnf09/6JJWaNjW9G+MGm+e2Q+VDH qCVICA6NRgsSHCzZ1VpIUU091iet88/mNfNyrUPJU4tcyuoNbz4p0U185uEKaTF+ow24 8ZbN28rWVhe2AQvzmUHMKLWrQvmoGI85htZby1Hdi7D2J3hTWPyFd0WzjFIEqz/GXv2f VFA8sLLn4pHjIdUue0sKCumUYtr/TL9BWeQUm6n90NWYDuKocWA+EIXetj1z9Jh0WGYy C5BA== MIME-Version: 1.0 X-Received: by 10.205.25.6 with SMTP id rg6mr4948943bkb.101.1366337671342; Thu, 18 Apr 2013 19:14:31 -0700 (PDT) Received: by 10.204.0.74 with HTTP; Thu, 18 Apr 2013 19:14:31 -0700 (PDT) Date: Fri, 19 Apr 2013 10:14:31 +0800 Message-ID: Subject: [PATCH -next] brcmfmac: fix potential NULL pointer dereference in brcmf_fws_flow_control_check() From: Wei Yongjun To: brudley@broadcom.com, arend@broadcom.com, frankyl@broadcom.com, meuleman@broadcom.com, linville@tuxdriver.com, pieterpg@broadcom.com, phaber@broadcom.com Cc: yongjun_wei@trendmicro.com.cn, linux-wireless@vger.kernel.org, brcm80211-dev-list@broadcom.com Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org From: Wei Yongjun The dereference to 'ifp' in debug code should be moved below the NULL test. Signed-off-by: Wei Yongjun Acked-by: Arend van Spriel --- drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c index 1bcd58c..69d5ad2 100644 --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c @@ -821,11 +821,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,