]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
mwifiex: limit channel number not to overflow memory
authorStone Piao <piaoyun@marvell.com>
Sat, 30 Mar 2013 02:21:21 +0000 (19:21 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 12 Apr 2013 16:52:07 +0000 (09:52 -0700)
commit 901ceba4e81e9dd6b4a3c4c37ee22000a6c5c65f upstream.

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

Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/wireless/mwifiex/cfg80211.c

index cdb11b3964e27dd68de20ac68ab8442772a070a1..3eca7100222e00bfe5fa1a6f4d3eb0c582870c06 100644 (file)
@@ -1846,7 +1846,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;