Skip to content

Commit

Permalink
mac80211: fix non RCU-safe sta_list manipulation
Browse files Browse the repository at this point in the history
sta_info_cleanup locks the sta_list using rcu_read_lock however
the delete operation isn't rcu safe. A race between sta_info_cleanup
timer being called and a STA being removed can occur which leads
to a panic while traversing sta_list. Fix this by switching to the
RCU-safe versions.

Cc: stable@vger.kernel.org
Reported-by: Eyal Shapira <eyal@wizery.com>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
  • Loading branch information
Arik Nemtsov authored and John W. Linville committed Jun 4, 2012
1 parent 69aaedd commit 794454c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ static int sta_info_insert_finish(struct sta_info *sta) __acquires(RCU)
/* make the station visible */
sta_info_hash_add(local, sta);

list_add(&sta->list, &local->sta_list);
list_add_rcu(&sta->list, &local->sta_list);

set_sta_flag(sta, WLAN_STA_INSERTED);

Expand Down Expand Up @@ -688,7 +688,7 @@ int __must_check __sta_info_destroy(struct sta_info *sta)
if (ret)
return ret;

list_del(&sta->list);
list_del_rcu(&sta->list);

mutex_lock(&local->key_mtx);
for (i = 0; i < NUM_DEFAULT_KEYS; i++)
Expand Down

0 comments on commit 794454c

Please sign in to comment.