iwlwifi: out-of-bounds access in iwl_init_sband_channels
authorAdrien Schildknecht <adrien+dev@schischi.me>
Fri, 14 Aug 2015 00:35:32 +0000 (02:35 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 18 Aug 2015 07:25:25 +0000 (10:25 +0300)
KASan error report:
==================================================================
BUG: KASan: out of bounds access in iwl_init_sband_channels+0x207/0x260 [iwlwifi] at addr ffff8800c2d0aac8
Read of size 4 by task modprobe/329
==================================================================

Both loops of this function compare data from the 'chan' array and then
check if the index is valid.

The 2 conditions should be inverted to avoid an out-of-bounds access.

Signed-off-by: Adrien Schildknecht <adrien+dev@schischi.me>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/iwl-eeprom-parse.c

index 21302b6f2bfd79a8e8617a345e3771f6608c0145..acc3d186c5c101b0834fb4e424fe2203a66bb2d0 100644 (file)
@@ -713,12 +713,12 @@ int iwl_init_sband_channels(struct iwl_nvm_data *data,
        struct ieee80211_channel *chan = &data->channels[0];
        int n = 0, idx = 0;
 
-       while (chan->band != band && idx < n_channels)
+       while (idx < n_channels && chan->band != band)
                chan = &data->channels[++idx];
 
        sband->channels = &data->channels[idx];
 
-       while (chan->band == band && idx < n_channels) {
+       while (idx < n_channels && chan->band == band) {
                chan = &data->channels[++idx];
                n++;
        }
This page took 0.025325 seconds and 5 git commands to generate.