brcmsmac: fix NULL pointer crash in brcms_c_regd_init()
authorArend van Spriel <arend@broadcom.com>
Thu, 21 Jun 2012 13:49:13 +0000 (15:49 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 22 Jun 2012 18:44:05 +0000 (14:44 -0400)
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@canonical.com>
Signed-off-by: Arend van Spriel <arend@broadcom.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/brcm80211/brcmsmac/channel.c

index d3c726021c357f79b6a2ba4fa7c5a0caa45fd9d4..2d365d3486df9722e5c1642aaf3252fd9c311ad3 100644 (file)
@@ -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;
+
                wlc_phy_chanspec_band_validch(band->pi, band->bandtype,
                                              &sup_chan);