net/wireless: Check for number of sub bands

WiFi Drivers can advertize the number of bands dynamically.
A check has been added to see if the band information is
present and only then the values are extracted.
Without this check, a kernel crash shall occur as we would
extract the band information though the driver does not
advertize.

Change-Id: Ia726a692a3c2dcef2fcff0a59363053524c5f806
Signed-off-by: Sunil Dutt Undekari<duttus@codeaurora.org>
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index c92906c..ef59862 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -3508,7 +3508,9 @@
 		       request->ie_len);
 	}
 	for (i = 0; i < IEEE80211_NUM_BANDS; i++)
-		request->rates[i] = (1 << wiphy->bands[i]->n_bitrates) - 1;
+		if (wiphy->bands[i])
+			request->rates[i] =
+				(1 << wiphy->bands[i]->n_bitrates) - 1;
 	if (info->attrs[NL80211_ATTR_SCAN_SUPP_RATES]) {
 		nla_for_each_nested(attr,
 				    info->attrs[NL80211_ATTR_SCAN_SUPP_RATES],