Search Linux Wireless

Re: [PATCH] brcmsmac: fix NULL pointer crash in brcms_c_regd_init()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Arend,

Sorry for my slow response. I was on vacation last week.

On Thu, Jun 21, 2012 at 03:49:13PM +0200, Arend van Spriel wrote:
> In the function brcms_c_regd_init() the channels are validated
> against the device capabilities. This is done for both 2.4G and
> 5G band, but there are devices that are 2.4G only, ie. BCM4313.
> For that device this leads to a NULL dereference. This patch adds
> a check in brcms_c_regd_init() to fix this.
> 
> Issue introduced in wireless-next tree by following commit:
> cf03c5d brcm80211: smac: inform mac80211 of the X2 regulatory domain
> 
> Cc: Seth Forshee <seth.forshee@xxxxxxxxxxxxx>
> Signed-off-by: Arend van Spriel <arend@xxxxxxxxxxxx>
> ---
> Noticed that one of smoketest machines actually was not sending results
> ever since I staged regulatory fixes for it. This particular system has
> a 2.4G card fitted so the root cause was quickly found.
> 
> Gr. AvS
> ---
>  drivers/net/wireless/brcm80211/brcmsmac/channel.c |    5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/drivers/net/wireless/brcm80211/brcmsmac/channel.c b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> index d3c7260..2d365d3 100644
> --- a/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> +++ b/drivers/net/wireless/brcm80211/brcmsmac/channel.c
> @@ -768,6 +768,11 @@ void brcms_c_regd_init(struct brcms_c_info *wlc)
>  			band = wlc->bandstate[BAND_2G_INDEX];
>  		else
>  			band = wlc->bandstate[BAND_5G_INDEX];
> +
> +		/* skip if band not initialized */
> +		if (band->pi == NULL)
> +			continue;
> +

Yeah, I definitely messed that up.

This looks fine, but it strikes me that it might simplify things a bit
to change the loop to iterate over over wlc->pub->_nbands instead. The
difference is pretty minor though, and since John has already applied
this patch there's probably no reason to change it.

Thanks,
Seth

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux