summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorDmitry Shmidt <dimitrysh@google.com>2012-04-10 15:44:41 -0700
committerOm Prakash Singh <omp@nvidia.com>2012-06-15 14:15:17 +0530
commit8e520c423374a7d2fe383019e69d59a99c9f47ed (patch)
treed63693f75adb517faf9ee1e7823ff1a5d6f12946 /drivers
parentf7136c9955912b104e1d2d11cc2b1ace7de7df91 (diff)
net: wireless: bcmdhd: Fix improper band handling
Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/wireless/bcmdhd/wl_cfg80211.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/drivers/net/wireless/bcmdhd/wl_cfg80211.c b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
index 8009e03fdcf3..19d675a2b8db 100644
--- a/drivers/net/wireless/bcmdhd/wl_cfg80211.c
+++ b/drivers/net/wireless/bcmdhd/wl_cfg80211.c
@@ -4509,6 +4509,11 @@ static s32 wl_inform_single_bss(struct wl_priv *wl, struct wl_bss_info *bi)
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
+ if (!band) {
+ WL_ERR(("No valid band"));
+ kfree(notif_bss_info);
+ return -EINVAL;
+ }
notif_bss_info->rssi = dtoh16(bi->RSSI);
memcpy(mgmt->bssid, &bi->BSSID, ETHER_ADDR_LEN);
mgmt_type = wl->active_scan ?
@@ -4713,7 +4718,10 @@ wl_notify_connect_status_ap(struct wl_priv *wl, struct net_device *ndev,
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
-
+ if (!band) {
+ WL_ERR(("No valid band"));
+ return -EINVAL;
+ }
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
freq = ieee80211_channel_to_frequency(channel);
#else
@@ -5296,7 +5304,10 @@ wl_notify_rx_mgmt_frame(struct wl_priv *wl, struct net_device *ndev,
band = wiphy->bands[IEEE80211_BAND_2GHZ];
else
band = wiphy->bands[IEEE80211_BAND_5GHZ];
-
+ if (!band) {
+ WL_ERR(("No valid band"));
+ return -EINVAL;
+ }
#if LINUX_VERSION_CODE == KERNEL_VERSION(2, 6, 38) && !defined(WL_COMPAT_WIRELESS)
freq = ieee80211_channel_to_frequency(channel);
#else
@@ -6675,8 +6686,8 @@ s32 wl_update_wiphybands(struct wl_priv *wl)
}
wiphy = wl_to_wiphy(wl);
nband = bandlist[0];
+ wiphy->bands[IEEE80211_BAND_2GHZ] = &__wl_band_2ghz;
wiphy->bands[IEEE80211_BAND_5GHZ] = NULL;
- wiphy->bands[IEEE80211_BAND_2GHZ] = NULL;
err = wldev_iovar_getint(wl_to_prmry_ndev(wl), "nmode", &nmode);
if (unlikely(err)) {
@@ -6690,7 +6701,7 @@ s32 wl_update_wiphybands(struct wl_priv *wl)
}
}
- for (i = 1; i <= nband && i < sizeof(bandlist); i++) {
+ for (i = 1; i <= nband && i < sizeof(bandlist)/sizeof(u32); i++) {
index = -1;
if (bandlist[i] == WLC_BAND_5G) {
wiphy->bands[IEEE80211_BAND_5GHZ] =