diff options
author | Helmut Schaa <helmut.schaa@googlemail.com> | 2012-01-27 05:02:53 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-01-30 15:48:28 -0500 |
commit | 4f3eb0ba4817e55e1b5b2f63fcf3f266c328fc1a (patch) | |
tree | bd3d01eb44f353f4a012e53919bfc843c08a14d5 | |
parent | 19468413e8d98d44be8daf0acaf8d576dfc53fa2 (diff) |
mac80211: Move num_sta_ps counter decrement after synchronize_rcu
Unted the assumption that the sta struct is still accessible before the
synchronize_rcu call we should move the num_sta_ps counter decrement
after synchronize_rcu to avoid incorrect decrements if num_sta_ps.
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | net/mac80211/sta_info.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 1fb4770a7d13..fa0823892b2d 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -750,15 +750,6 @@ int __must_check __sta_info_destroy(struct sta_info *sta) | |||
750 | 750 | ||
751 | sta->dead = true; | 751 | sta->dead = true; |
752 | 752 | ||
753 | if (test_sta_flag(sta, WLAN_STA_PS_STA)) { | ||
754 | BUG_ON(!sdata->bss); | ||
755 | |||
756 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
757 | |||
758 | atomic_dec(&sdata->bss->num_sta_ps); | ||
759 | sta_info_recalc_tim(sta); | ||
760 | } | ||
761 | |||
762 | local->num_sta--; | 753 | local->num_sta--; |
763 | local->sta_generation++; | 754 | local->sta_generation++; |
764 | 755 | ||
@@ -790,6 +781,15 @@ int __must_check __sta_info_destroy(struct sta_info *sta) | |||
790 | */ | 781 | */ |
791 | synchronize_rcu(); | 782 | synchronize_rcu(); |
792 | 783 | ||
784 | if (test_sta_flag(sta, WLAN_STA_PS_STA)) { | ||
785 | BUG_ON(!sdata->bss); | ||
786 | |||
787 | clear_sta_flag(sta, WLAN_STA_PS_STA); | ||
788 | |||
789 | atomic_dec(&sdata->bss->num_sta_ps); | ||
790 | sta_info_recalc_tim(sta); | ||
791 | } | ||
792 | |||
793 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { | 793 | for (ac = 0; ac < IEEE80211_NUM_ACS; ac++) { |
794 | local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]); | 794 | local->total_ps_buffered -= skb_queue_len(&sta->ps_tx_buf[ac]); |
795 | __skb_queue_purge(&sta->ps_tx_buf[ac]); | 795 | __skb_queue_purge(&sta->ps_tx_buf[ac]); |