2015-12-02 11:45:22

by Colin King

[permalink] [raw]
Subject: [PATCH] brcmfmac: only lock and unlock fws if fws is not null

From: Colin Ian King <[email protected]>

There is a null ptr check for fws to set bcmc_credit_check, however,
there a lock and unlock on fws should only performed if fwts is
also not null to also avoid a potential null pointer deference.

Signed-off-by: Colin Ian King <[email protected]>
---
drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
index 086cac3..092f33f 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
@@ -1609,10 +1609,11 @@ static int brcmf_fws_notify_bcmc_credit_support(struct brcmf_if *ifp,
{
struct brcmf_fws_info *fws = ifp->drvr->fws;

- brcmf_fws_lock(fws);
- if (fws)
+ if (fws) {
+ brcmf_fws_lock(fws);
fws->bcmc_credit_check = true;
- brcmf_fws_unlock(fws);
+ brcmf_fws_unlock(fws);
+ }
return 0;
}

--
2.6.2


2015-12-02 13:03:47

by Arend van Spriel

[permalink] [raw]
Subject: Re: [PATCH] brcmfmac: only lock and unlock fws if fws is not null

On 12/02/2015 12:45 PM, Colin King wrote:
> From: Colin Ian King <[email protected]>
>
> There is a null ptr check for fws to set bcmc_credit_check, however,
> there a lock and unlock on fws should only performed if fwts is
> also not null to also avoid a potential null pointer deference.

Acked-by: Arend van Spriel <[email protected]>
> Signed-off-by: Colin Ian King <[email protected]>
> ---
> drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
> index 086cac3..092f33f 100644
> --- a/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
> +++ b/drivers/net/wireless/brcm80211/brcmfmac/fwsignal.c
> @@ -1609,10 +1609,11 @@ static int brcmf_fws_notify_bcmc_credit_support(struct brcmf_if *ifp,
> {
> struct brcmf_fws_info *fws = ifp->drvr->fws;
>
> - brcmf_fws_lock(fws);
> - if (fws)
> + if (fws) {
> + brcmf_fws_lock(fws);
> fws->bcmc_credit_check = true;
> - brcmf_fws_unlock(fws);
> + brcmf_fws_unlock(fws);
> + }
> return 0;
> }
>
>

2015-12-11 11:14:42

by Kalle Valo

[permalink] [raw]
Subject: Re: brcmfmac: only lock and unlock fws if fws is not null


> From: Colin Ian King <[email protected]>
>
> There is a null ptr check for fws to set bcmc_credit_check, however,
> there a lock and unlock on fws should only performed if fwts is
> also not null to also avoid a potential null pointer deference.
>
> Signed-off-by: Colin Ian King <[email protected]>
> Acked-by: Arend van Spriel <[email protected]>

Thanks, applied to wireless-drivers-next.git.

Kalle Valo