diff mbox

[-next] brcmfmac: fix potential NULL pointer dereference in brcmf_fws_flow_control_check()

Message ID CAPgLHd8KiH+BGZJ704yk2ZsiVQC8GH4FUZhC-_rstdoaA4BOaA@mail.gmail.com (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Wei Yongjun April 19, 2013, 2:14 a.m. UTC
From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>

The dereference to 'ifp' in debug code should be moved below the NULL test.

Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
---
 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

Comments

Arend van Spriel April 19, 2013, 8:12 a.m. UTC | #1
On 04/19/2013 04:14 AM, Wei Yongjun wrote:
> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
>
> The dereference to 'ifp' in debug code should be moved below the NULL test.

Acked-by: Arend van Spriel <arend@broadcom.com>
> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn>
> ---
>   drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 5 +++--
>   1 file changed, 3 insertions(+), 2 deletions(-)
>
> 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,
>
>


--
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 mbox

Patch

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,