mac80211: atomically check whether STA exists already
authorJohannes Berg <johannes@sipsolutions.net>
Thu, 21 Feb 2008 13:09:30 +0000 (14:09 +0100)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 29 Feb 2008 20:41:34 +0000 (15:41 -0500)
commit43ba7e958f2ca05e4e9171a15402288419289d71
tree15b7a04a7db402dd286f83cc56c21b336189da09
parentd46e144b65bf053b25d134ec9f52a38e63e04bb4
mac80211: atomically check whether STA exists already

When a STA structure is added, it is often checked whether it
already exists before adding it. This, however, isn't done
atomically so there is a race condition that could lead to two
STA structures being added with the same MAC address. This
patch changes sta_info_add() to return an ERR_PTR in case
of failure and adds the failure mode -EEXIST when the STA
already exists.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
Cc: Luis Carlos Cobo <luisca@cozybit.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/cfg.c
net/mac80211/ieee80211.c
net/mac80211/ieee80211_sta.c
net/mac80211/sta_info.c
net/mac80211/sta_info.h