Re: Oops in wireless from today's git

From: Chris Clayton
Date: Sun May 10 2009 - 18:29:27 EST


2009/5/10 Jiri Slaby <jirislaby@xxxxxxxxx>:
> On 05/10/2009 09:39 PM, Chris Clayton wrote:
>> I've just done a git pull and built, installed and booted the kernel.
>> Unfortunately I got the oops below.
>
> What's your HEAD? Looks like the issue solved by
> 0cc113d866fa87c1455cbaff8d1f7ac054090bd5.
>

Sorry, I'm a real novice git user, but if by HEAD you mean the latest
commit, its a4d7749be5de4a7261bcbe3c7d96c748792ec455. The file
.git/FETCH_HEAD contains:

a4d7749be5de4a7261bcbe3c7d96c748792ec455 branch
'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6


I've done some investigating and found that reverting the following
patch prevents the oops:

mac80211: minstrel, fix memory corruption

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@xxxxxxxxx>
Cc: Felix Fietkau <nbd@xxxxxxxxxxx>
Signed-off-by: John W. Linville <linville@xxxxxxxxxxxxx>
---

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;
}

I can also prevent the oops by applying this patch:

--- linux-2.6/net/mac80211/rc80211_minstrel.c.save 2009-05-10
21:53:34.000000000 +0000
+++ linux-2.6/net/mac80211/rc80211_minstrel.c 2009-05-10
21:53:57.000000000 +0000
@@ -477,7 +477,7 @@ minstrel_alloc_sta(void *priv, struct ie

for (i = 0; i < IEEE80211_NUM_BANDS; i++) {
sband = hw->wiphy->bands[i];
- if (sband->n_bitrates > max_rates)
+ if (sband && sband->n_bitrates > max_rates)
max_rates = sband->n_bitrates;
}


--
No, Sir; there is nothing which has yet been contrived by man, by which
so much happiness is produced as by a good tavern or inn - Doctor Samuel
Johnson
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/