Skip to contentSkip to conversation

mac80211: Fix sta_mtx unlocking on insert STA failure path

PATCH In review Jouni Malinen 2 participants 3 messages Mar 6, 2010 – Mar 7, 2010 mac80211

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: Fix sta_mtx unlocking on insert STA failure path

Commit 34e895075e21be3e21e71d6317440d1ee7969ad0 introduced sta_mtx locking into sta_info_insert() (now sta_info_insert_rcu), but forgot to unlock this mutex on one of the error paths. Fix this by adding the missing mutex_unlock() call for the case where STA insert fails due to an entry existing already. This may happen at least in AP mode when a STA roams between two BSSes (vifs).

---
 net/mac80211/sta_info.c |    1 +
 1 file changed, 1 insertion(+)

By the way, that roaming between two vifs did not work either, but regardless, fixing missing mutex_unlock is of higher priority.. The STA entry was not updated to point to the correct dev when the STA roamed from one BSS to another one (both BSSes running on the same wiphy). To be more exact, I think it was updated once, but not when roaming back to the original BSS.

net/mac80211/sta_info.c +1 -0
@@ -434,6 +434,7 @@ int sta_info_insert_rcu(struct sta_info 
 	/* check if STA exists already */
 	if (sta_info_get_bss(sdata, sta->sta.addr)) {
 		spin_unlock_irqrestore(&local->sta_lock, flags);
+		mutex_unlock(&local->sta_mtx);
 		rcu_read_lock();
 		err = -EEXIST;
 		goto out_free;
Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
maintainer
#1 lore raw
Quoted 8 lines · Jouni Malinen

Commit 34e895075e21be3e21e71d6317440d1ee7969ad0 introduced sta_mtx locking into sta_info_insert() (now sta_info_insert_rcu), but forgot to unlock this mutex on one of the error paths. Fix this by adding the missing mutex_unlock() call for the case where STA insert fails due to an entry existing already. This may happen at least in AP mode when a STA roams between two BSSes (vifs).

Thanks.

Quoted 10 lines
---
 net/mac80211/sta_info.c |    1 +
 1 file changed, 1 insertion(+)

By the way, that roaming between two vifs did not work either, but regardless, fixing missing mutex_unlock is of higher priority.. The STA entry was not updated to point to the correct dev when the STA roamed from one BSS to another one (both BSSes running on the same wiphy). To be more exact, I think it was updated once, but not when roaming back to the original BSS.

This must be due to the sta_find_bss thing Felix did because hostapd wasn't using the right ifindex...

johannes

#2 lore raw
Quoted 9 lines · Johannes Berg
Quoted 6 lines

By the way, that roaming between two vifs did not work either, but regardless, fixing missing mutex_unlock is of higher priority.. The STA entry was not updated to point to the correct dev when the STA roamed from one BSS to another one (both BSSes running on the same wiphy). To be more exact, I think it was updated once, but not when roaming back to the original BSS.

This must be due to the sta_find_bss thing Felix did because hostapd wasn't using the right ifindex...

Yes, it was and I finally remembered to go through the patches from Felix to get this fixed. Multi-BSS works now with the current hostap.git version of hostapd and driver_nl80211.c.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA