summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2022-06-20 15:29:28 +0200
committerJohannes Berg <johannes.berg@intel.com>2022-07-15 11:43:13 +0200
commit3d1cc7cdf2e848181398837fe158bf0850d29ee6 (patch)
tree011eb80edea4ba93f06e9b2e0d3d0fc612389cff /net
parentwifi: nl80211: hold wdev mutex for channel switch APIs (diff)
downloadlinux-3d1cc7cdf2e848181398837fe158bf0850d29ee6.tar.xz
linux-3d1cc7cdf2e848181398837fe158bf0850d29ee6.zip
wifi: nl80211: hold wdev mutex for station APIs
Since this will need to refer - at least in part - to the link stations of an MLD, hold the wdev mutex for driver convenience. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/nl80211.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 59ea1157969e..9eee853efd57 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -6976,7 +6976,9 @@ static int nl80211_set_station(struct sk_buff *skb, struct genl_info *info)
}
/* driver will call cfg80211_check_station_change() */
+ wdev_lock(dev->ieee80211_ptr);
err = rdev_change_station(rdev, dev, mac_addr, &params);
+ wdev_unlock(dev->ieee80211_ptr);
out_put_vlan:
dev_put(params.vlan);
@@ -7232,7 +7234,9 @@ static int nl80211_new_station(struct sk_buff *skb, struct genl_info *info)
/* be aware of params.vlan when changing code here */
+ wdev_lock(dev->ieee80211_ptr);
err = rdev_add_station(rdev, dev, mac_addr, &params);
+ wdev_unlock(dev->ieee80211_ptr);
dev_put(params.vlan);
return err;
@@ -7243,6 +7247,7 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct net_device *dev = info->user_ptr[1];
struct station_del_parameters params;
+ int ret;
memset(&params, 0, sizeof(params));
@@ -7290,7 +7295,11 @@ static int nl80211_del_station(struct sk_buff *skb, struct genl_info *info)
params.reason_code = WLAN_REASON_PREV_AUTH_NOT_VALID;
}
- return rdev_del_station(rdev, dev, &params);
+ wdev_lock(dev->ieee80211_ptr);
+ ret = rdev_del_station(rdev, dev, &params);
+ wdev_unlock(dev->ieee80211_ptr);
+
+ return ret;
}
static int nl80211_send_mpath(struct sk_buff *msg, u32 portid, u32 seq,