Skip to content

Commit

Permalink
mac80211: Fix incorrect num_sta_ps decrement in __sta_info_destroy
Browse files Browse the repository at this point in the history
When WLAN_STA_PS_DRIVER is set by ieee80211_sta_block_awake the
num_sta_ps counter is not incremented. Hence, we shouldn't decrement
it in __sta_info_destroy if only WLAN_STA_PS_DRIVER is set. This
could result in an incorrect num_sta_ps counter leading to strange side
effects with associated powersaving clients.

Fix this by only decrementing num_sta_ps when WLAN_STA_PS_STA was set
before.

Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Helmut Schaa authored and John W. Linville committed Jan 30, 2012
1 parent 83d5cc0 commit 2ab694d
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,12 +750,10 @@ int __must_check __sta_info_destroy(struct sta_info *sta)

sta->dead = true;

if (test_sta_flag(sta, WLAN_STA_PS_STA) ||
test_sta_flag(sta, WLAN_STA_PS_DRIVER)) {
if (test_sta_flag(sta, WLAN_STA_PS_STA)) {
BUG_ON(!sdata->bss);

clear_sta_flag(sta, WLAN_STA_PS_STA);
clear_sta_flag(sta, WLAN_STA_PS_DRIVER);

atomic_dec(&sdata->bss->num_sta_ps);
sta_info_recalc_tim(sta);
Expand Down

0 comments on commit 2ab694d

Please sign in to comment.