Skip to contentSkip to conversation

mwifiex: limit channel number not to overflow memory

PATCH New Bing Zhao 1 participant 1 message Mar 30, 2013 Networking drivers (wireless)

lore
Share & tools
lore

Bing Zhao

author
#0 lore raw

PATCH 1/1 mwifiex: limit channel number not to overflow memory

From: Stone Piao <[email protected]>

Limit the channel number in scan request, or the driver scan config structure memory will be overflowed.

---
 drivers/net/wireless/mwifiex/cfg80211.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
drivers/net/wireless/mwifiex/cfg80211.c +2 -1
index 8f161e1..4701294 100644
@@ -1904,7 +1904,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
 		}
 	}
 
-	for (i = 0; i < request->n_channels; i++) {
+	for (i = 0; i < min_t(u32, request->n_channels,
+			      MWIFIEX_USER_SCAN_CHAN_MAX); i++) {
 		chan = request->channels[i];
 		priv->user_scan_cfg->chan_list[i].chan_number = chan->hw_value;
 		priv->user_scan_cfg->chan_list[i].radio_type = chan->band;
Signature · 1 line
1.7.0.2