cfg80211: fix scan crash on single-band cards
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / net / wireless / nl80211.c
index 20aa390cf33875016e5e773d5a6e77354df3b084..28d2aa109beecbaa8d5ef97890142a16e134cbad 100644 (file)
@@ -3454,7 +3454,9 @@ static int nl80211_trigger_scan(struct sk_buff *skb, struct genl_info *info)
        }
 
        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,