diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2008-02-21 08:09:30 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2008-02-29 15:41:34 -0500 |
commit | 43ba7e958f2ca05e4e9171a15402288419289d71 (patch) | |
tree | 15b7a04a7db402dd286f83cc56c21b336189da09 /net/mac80211/ieee80211.c | |
parent | d46e144b65bf053b25d134ec9f52a38e63e04bb4 (diff) |
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>
Diffstat (limited to 'net/mac80211/ieee80211.c')
-rw-r--r-- | net/mac80211/ieee80211.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/net/mac80211/ieee80211.c b/net/mac80211/ieee80211.c index a00858dbab18..f82ebdd53d48 100644 --- a/net/mac80211/ieee80211.c +++ b/net/mac80211/ieee80211.c | |||
@@ -838,8 +838,8 @@ int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr) | |||
838 | 838 | ||
839 | /* Create STA entry for the new peer */ | 839 | /* Create STA entry for the new peer */ |
840 | sta = sta_info_add(local, dev, remote_addr, GFP_KERNEL); | 840 | sta = sta_info_add(local, dev, remote_addr, GFP_KERNEL); |
841 | if (!sta) | 841 | if (IS_ERR(sta)) |
842 | return -ENOMEM; | 842 | return PTR_ERR(sta); |
843 | 843 | ||
844 | sta->flags |= WLAN_STA_AUTHORIZED; | 844 | sta->flags |= WLAN_STA_AUTHORIZED; |
845 | 845 | ||