Skip to contentSkip to conversation

cfg80211: add 802.11ad (60gHz band) support

DISCUSSION Dan Carpenter 3 participants 6 messages Jul 3, 2012

lore
Share & tools
lore
#0 lore raw

Hello Vladimir Kondratiev,

The patch 3a0c52a6d82c: "cfg80211: add 802.11ad (60gHz band) support" from Jul 2, 2012, leads to the following warning:
drivers/net/wireless/mac80211_hwsim.c:1841 init_mac80211_hwsim()

	 warn: buffer overflow 'data->bands' 2 <= 2

drivers/net/wireless/mac80211_hwsim.c
1839

  1840                  for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
                                                                ^^^^^^^^^^^^^^^^^^^

We raised IEEE80211_NUM_BANDS to 3.

  1841                          struct ieee80211_supported_band *sband = &data->bands[band];
                                                                                ^^^^^^^^^^^

This only has 2 elements still.

  1842                          switch (band) {
  1843                          case IEEE80211_BAND_2GHZ:

It causes a bogus dereference later.

regards,
dan carpenter

#1 lore raw
Quoted 13 lines · Dan Carpenter

Hello Vladimir Kondratiev,

The patch 3a0c52a6d82c: "cfg80211: add 802.11ad (60gHz band) support" from Jul 2, 2012, leads to the following warning:
drivers/net/wireless/mac80211_hwsim.c:1841 init_mac80211_hwsim()

	 warn: buffer overflow 'data->bands' 2 <= 2

drivers/net/wireless/mac80211_hwsim.c
1839

  1840                  for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
                                                                ^^^^^^^^^^^^^^^^^^^

We raised IEEE80211_NUM_BANDS to 3.

Quoted 8 lines
  1841                          struct ieee80211_supported_band *sband = &data->bands[band];
                                                                                ^^^^^^^^^^^

This only has 2 elements still.

  1842                          switch (band) {
  1843                          case IEEE80211_BAND_2GHZ:

It causes a bogus dereference later.

Thanks Dan!

Is this one of your non-default tests? I think I ran smatch on this, but it might be old. Anyway, I'll commit this fix:

http://p.sipsolutions.net/a1c40eea7e33541b.txt

johannes

#2 lore raw
Quoted 8 lines · Johannes Berg

Thanks Dan!

Is this one of your non-default tests? I think I ran smatch on this, but it might be old. Anyway, I'll commit this fix:

http://p.sipsolutions.net/a1c40eea7e33541b.txt

johannes

Yes, exactly!

Was about to mail same patch.

What is the best method to catch such cases? "make allmodconfig", or is there something better?

Tnanks, Vladimir

#3 lore raw
Quoted 8 lines · Vladimir Kondratiev
Quoted 7 lines · Johannes Berg

Thanks Dan!

Is this one of your non-default tests? I think I ran smatch on this, but it might be old. Anyway, I'll commit this fix:

http://p.sipsolutions.net/a1c40eea7e33541b.txt

Quoted 8 lines
Quoted 1 line

johannes

Yes, exactly!

Was about to mail same patch.

What is the best method to catch such cases? "make allmodconfig", or is there something better?

This was a Smatch warning.

http://smatch.sourceforge.net/

regards,
dan carpenter

#4 lore raw
In reply to Johannes Berg
Quoted 21 lines · Johannes Berg
Quoted 20 lines · Dan Carpenter

Hello Vladimir Kondratiev,

The patch 3a0c52a6d82c: "cfg80211: add 802.11ad (60gHz band) support" from Jul 2, 2012, leads to the following warning:
drivers/net/wireless/mac80211_hwsim.c:1841 init_mac80211_hwsim()

	 warn: buffer overflow 'data->bands' 2 <= 2

drivers/net/wireless/mac80211_hwsim.c
1839

  1840                  for (band = IEEE80211_BAND_2GHZ; band < IEEE80211_NUM_BANDS; band++) {
                                                                ^^^^^^^^^^^^^^^^^^^

We raised IEEE80211_NUM_BANDS to 3.

  1841                          struct ieee80211_supported_band *sband = &data->bands[band];
                                                                                ^^^^^^^^^^^

This only has 2 elements still.

  1842                          switch (band) {
  1843                          case IEEE80211_BAND_2GHZ:
Quoted 6 lines
Quoted 1 line

It causes a bogus dereference later.

Thanks Dan!

Is this one of your non-default tests? I think I ran smatch on this, but it might be old.

It should be on by default in the latest code. :)

regards,
dan carpenter

#5 lore raw
Quoted 6 lines · Dan Carpenter
Quoted 4 lines

Thanks Dan!

Is this one of your non-default tests? I think I ran smatch on this, but it might be old.

It should be on by default in the latest code. :)

I'll update anyway, but because of the huge number of warnings in all the various wireless drives I didn't actually run it, I only ran it on the mac80211 & cfg80211 code ... oops.

johannes