Commits

Sar Castillo committed 5cf0490

[PATCH] net: wireless: bcmdhd: Fix improper band handling

From d8392db1afb5ea1eabfc3f15ddc95ced72ec076e Mon Sep 17 00:00:00 2001
From: Dmitry Shmidt <dimitrysh@google.com>
Date: Tue, 10 Apr 2012 15:44:41 -0700
Subject: [PATCH] net: wireless: bcmdhd: Fix improper band handling

Signed-off-by: Dmitry Shmidt <dimitrysh@google.com>

Comments (0)

Files changed (1)

drivers/net/wireless/bcmdhd/src/wl/sys/wl_cfg80211.c

 	mgmt = (wpa_suite_auth_key_mgmt_t *)&ucast->list[count];
 	count = ltoh16_ua(&mgmt->count);
 	len -= WPA_IE_SUITE_COUNT_LEN;
+	if (!band) {
+		WL_ERR(("No valid band"));
+		kfree(notif_bss_info);
+		return -EINVAL;
+	}
 	for (i = 0; i < count && len >= WPA_SUITE_LEN;
 		i++, len -= WPA_SUITE_LEN) {
 		if (!bcmp(mgmt->list[i].oui, WPA_OUI, WPA_OUI_LEN)) {
 			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);
 		(void)band->band;
 		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);
 	(void)band->band;