linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH 1/2] mac80211: minstrel, fix memory corruption
@ 2009-05-05 18:43 Karol Szuster
  2009-05-05 19:18 ` [PATCH] mac80211: avoid NULL ptr deref when finding max_rates in PID and minstrel John W. Linville
  0 siblings, 1 reply; 14+ messages in thread
From: Karol Szuster @ 2009-05-05 18:43 UTC (permalink / raw)
  To: linux-wireless

Hi,

There is another problem with this piece of code. The sband will be NULL
after second iteration on single band device and cause null pointer
dereference. Everything is working with dual band card. Sorry, but i
don't know how to explain this clearly in English. I have looked on the
second patch for pid algorithm and found similar bug.

^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH 1/2] mac80211: minstrel, fix memory corruption
@ 2009-05-04 16:04 Jiri Slaby
  2009-05-04 16:17 ` Bob Copeland
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Jiri Slaby @ 2009-05-04 16:04 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, linux-kernel, Jiri Slaby, Felix Fietkau

minstrel doesn't count max rate count in fact, since it doesn't use
a loop variable `i' and hence allocs space only for bitrates found in
the first band.

Fix it by involving the `i' as an index so that it traverses all the
bands now and finds the real max bitrate count.

Signed-off-by: Jiri Slaby <jirislaby@gmail.com>
Cc: Felix Fietkau <nbd@openwrt.org>
---
 net/mac80211/rc80211_minstrel.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/rc80211_minstrel.c b/net/mac80211/rc80211_minstrel.c
index 3824990..70df3dc 100644
--- a/net/mac80211/rc80211_minstrel.c
+++ b/net/mac80211/rc80211_minstrel.c
@@ -476,7 +476,7 @@ minstrel_alloc_sta(void *priv, struct ieee80211_sta *sta, gfp_t gfp)
 		return NULL;
 
 	for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
-		sband = hw->wiphy->bands[hw->conf.channel->band];
+		sband = hw->wiphy->bands[i];
 		if (sband->n_bitrates > max_rates)
 			max_rates = sband->n_bitrates;
 	}
-- 
1.6.2.4


^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2009-05-15 21:34 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-05 18:43 [PATCH 1/2] mac80211: minstrel, fix memory corruption Karol Szuster
2009-05-05 19:18 ` [PATCH] mac80211: avoid NULL ptr deref when finding max_rates in PID and minstrel John W. Linville
  -- strict thread matches above, loose matches on Subject: below --
2009-05-04 16:04 [PATCH 1/2] mac80211: minstrel, fix memory corruption Jiri Slaby
2009-05-04 16:17 ` Bob Copeland
2009-05-04 16:40 ` Felix Fietkau
2009-05-04 18:38 ` Luis R. Rodriguez
2009-05-04 18:41   ` Jiri Slaby
2009-05-15 18:21 ` Heinz Diehl
2009-05-15 18:33   ` John W. Linville
2009-05-15 18:49     ` Linus Torvalds
2009-05-15 18:53       ` John W. Linville
2009-05-15 21:25       ` Marcel Holtmann
2009-05-15 21:32         ` Linus Torvalds
2009-05-15 18:40   ` Jiri Slaby

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).