aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/nl80211.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-07-06 21:56:11 -0400
committerJohn W. Linville <linville@tuxdriver.com>2009-07-10 15:02:32 -0400
commit667503ddcb96f3b10211f997fe55907fa7509841 (patch)
tree5e2559e94a716bb81bfc7566e3e3a05267810c31 /net/wireless/nl80211.c
parent4f5dadcebb55fccef34722bbbf6401d39124c8a4 (diff)
cfg80211: fix locking
Over time, a lot of locking issues have crept into the smarts of cfg80211, so e.g. scan completion can race against a new scan, IBSS join can race against leaving an IBSS, etc. Introduce a new per-interface lock that protects most of the per-interface data that we need to keep track of, and sprinkle assertions about that lock everywhere. Some things now need to be offloaded to work structs so that we don't require being able to sleep in functions the drivers call. The exception to that are the MLME callbacks (rx_auth etc.) that currently only mac80211 calls because it was easier to do that there instead of in cfg80211, and future drivers implementing those calls will, if they ever exist, probably need to use a similar scheme like mac80211 anyway... In order to be able to handle _deauth and _disassoc properly, introduce a cookie passed to it that will determine locking requirements. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless/nl80211.c')
-rw-r--r--net/wireless/nl80211.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 4976eac888a3..cf4ac786b20a 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -4029,6 +4029,8 @@ static int nl80211_add_scan_req(struct sk_buff *msg,
4029 struct nlattr *nest; 4029 struct nlattr *nest;
4030 int i; 4030 int i;
4031 4031
4032 ASSERT_RDEV_LOCK(rdev);
4033
4032 if (WARN_ON(!req)) 4034 if (WARN_ON(!req))
4033 return 0; 4035 return 0;
4034 4036
@@ -4391,12 +4393,12 @@ void nl80211_send_roamed(struct cfg80211_registered_device *rdev,
4391 4393
4392void nl80211_send_disconnected(struct cfg80211_registered_device *rdev, 4394void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
4393 struct net_device *netdev, u16 reason, 4395 struct net_device *netdev, u16 reason,
4394 u8 *ie, size_t ie_len, bool from_ap, gfp_t gfp) 4396 const u8 *ie, size_t ie_len, bool from_ap)
4395{ 4397{
4396 struct sk_buff *msg; 4398 struct sk_buff *msg;
4397 void *hdr; 4399 void *hdr;
4398 4400
4399 msg = nlmsg_new(NLMSG_GOODSIZE, gfp); 4401 msg = nlmsg_new(NLMSG_GOODSIZE, GFP_KERNEL);
4400 if (!msg) 4402 if (!msg)
4401 return; 4403 return;
4402 4404
@@ -4420,7 +4422,7 @@ void nl80211_send_disconnected(struct cfg80211_registered_device *rdev,
4420 return; 4422 return;
4421 } 4423 }
4422 4424
4423 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, gfp); 4425 genlmsg_multicast(msg, 0, nl80211_mlme_mcgrp.id, GFP_KERNEL);
4424 return; 4426 return;
4425 4427
4426 nla_put_failure: 4428 nla_put_failure: