Skip to contentSkip to conversation

mac80211: Fix scan RX processing oops

PATCH In review Jouni Malinen 3 participants 5 messages Oct 11, 2008 – Oct 14, 2008 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Fix scan RX processing oops

ieee80211_bss_info_update() can return NULL. Verify that this is not the case before calling ieee802111_rx_bss_put() which would trigger an oops in interrupt context in atomic_dec_and_lock().

net/mac80211/scan.c +2 -1
Index: wireless-testing/net/mac80211/scan.c
===================================================================
@@ -388,7 +388,8 @@ ieee80211_scan_rx(struct ieee80211_sub_i
 	bss = ieee80211_bss_info_update(sdata->local, rx_status,
 					mgmt, skb->len, &elems,
 					freq, beacon);
-	ieee80211_rx_bss_put(sdata->local, bss);
+	if (bss)
+		ieee80211_rx_bss_put(sdata->local, bss);
 
 	dev_kfree_skb(skb);
 	return RX_QUEUED;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 5 lines · Jouni Malinen

ieee80211_bss_info_update() can return NULL. Verify that this is not the case before calling ieee802111_rx_bss_put() which would trigger an oops in interrupt context in atomic_dec_and_lock().

net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_i · line 392

Quoted 12 lines

Index: wireless-testing/net/mac80211/scan.c
===================================================================

net/mac80211/scan.c +2 -1
@@ -388,7 +388,8 @@ ieee80211_scan_rx(struct ieee80211_sub_i
 	bss = ieee80211_bss_info_update(sdata->local, rx_status,
 					mgmt, skb->len, &elems,
 					freq, beacon);
-	ieee80211_rx_bss_put(sdata->local, bss);
+	if (bss)
+		ieee80211_rx_bss_put(sdata->local, bss);

I keep falling into that trap, maybe the put function should just handle NULL instead...

johannes

#2 lore raw
Quoted 6 lines · Johannes Berg

net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_i · line 392

Quoted 3 lines
net/mac80211/scan.c +2 -1
-	ieee80211_rx_bss_put(sdata->local, bss);
+	if (bss)
+		ieee80211_rx_bss_put(sdata->local, bss);

I keep falling into that trap, maybe the put function should just handle NULL instead...

I though about that for half a second or so ;-) and ended up doing this instead after checking that other ieee80211_rx_bss_put() calls were only passing in non-NULL values. Anyway, I would be fine with _put() being able to handle NULL, too.

PS.

I don't know what exactly was triggering this oops (or well, what was triggering ieee80211_bss_info_update() to return NULL to be more exact), but it was happening very consistently in our office (but not anywhere else I've been this week). It was kind of funny to see that oops at the very moment when I was convincing people in a meeting that we can change mac80211 and should do so if it is the best location for something and makes it easier to implement something in a driver.. ;-)

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer
#3 lore raw
Quoted 8 lines · Jouni Malinen
Quoted 6 lines · Johannes Berg

net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_i · line 392

Quoted 3 lines
net/mac80211/scan.c +2 -1
-	ieee80211_rx_bss_put(sdata->local, bss);
+	if (bss)
+		ieee80211_rx_bss_put(sdata->local, bss);

I keep falling into that trap, maybe the put function should just handle NULL instead...

Quoted 4 lines

I though about that for half a second or so ;-) and ended up doing this instead after checking that other ieee80211_rx_bss_put() calls were only passing in non-NULL values. Anyway, I would be fine with _put() being able to handle NULL, too.

I looked at it before and for some reason decided against it too. Let's stick to this patch, I'll re-evaluate making it handle NULL.

Quoted 6 lines

PS.

I don't know what exactly was triggering this oops (or well, what was triggering ieee80211_bss_info_update() to return NULL to be more exact), but it was happening very consistently in our office (but not anywhere else I've been this week).

Strange. You probably have a mesh network with bogus mesh config or mesh ID IEs, I can't see the allocation fail consistently in your office ;)

Quoted 4 lines

It was kind of funny to see that oops at the
very moment when I was convincing people in a meeting that we can change mac80211 and should do so if it is the best location for something and makes it easier to implement something in a driver.. ;-)

Ouch, sorry :)

johannes

#4 lore raw

Johannes Berg a =E9crit :

Quoted 6 lines · Jouni Malinen
Quoted 5 lines · Johannes Berg
Quoted 4 lines

net/mac80211/scan.c ieee80211_scan_rx(struct ieee80211_sub_i · line 392

Quoted 3 lines
net/mac80211/scan.c +2 -1
-	ieee80211_rx_bss_put(sdata->local, bss);
+	if (bss)
+		ieee80211_rx_bss_put(sdata->local, bss);

I keep falling into that trap, maybe the put function should just h=

andle

Quoted 2 lines
Quoted 2 lines
Quoted 1 line

NULL instead...

I though about that for half a second or so ;-) and ended up doing t=

his

Quoted 1 line
Quoted 1 line

instead after checking that other ieee80211_rx_bss_put() calls were =

only

Quoted 1 line
Quoted 1 line

passing in non-NULL values. Anyway, I would be fine with _put() bein=

g

Quoted 3 lines
Quoted 1 line

able to handle NULL, too.

=20
I looked at it before and for some reason decided against it too. Let=

's

Quoted 5 lines

stick to this patch, I'll re-evaluate making it handle NULL. =20

Quoted 3 lines

PS.

I don't know what exactly was triggering this oops (or well, what wa=

s

Quoted 1 line
Quoted 1 line

triggering ieee80211_bss_info_update() to return NULL to be more exa=

ct),

Quoted 1 line
Quoted 1 line

but it was happening very consistently in our office (but not anywhe=

re

Quoted 3 lines
Quoted 1 line

else I've been this week).

=20
Strange. You probably have a mesh network with bogus mesh config or m=

esh

Quoted 1 line

ID IEs, I can't see the allocation fail consistently in your office ;=

)

Quoted 3 lines

=20

Quoted 2 lines

It was kind of funny to see that oops at the
very moment when I was convincing people in a meeting that we can ch=

ange

Quoted 1 line
Quoted 1 line

mac80211 and should do so if it is the best location for something a=

nd

Quoted 5 lines
Quoted 1 line

makes it easier to implement something in a driver.. ;-)

=20
Ouch, sorry :)
=20
johannes

BTW, This is indeed Mesh Config IE received with incorrect mesh_id_len (8 bytes instead of 19 bytes as expected). I really think the current patch is the correct one.

Regards,
Benoit
--
To unsubscribe from this list: send the line "unsubscribe linux-wireles= s" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html