diff options
author | Johannes Berg <johannes.berg@intel.com> | 2022-06-20 15:25:56 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2022-07-15 11:43:13 +0200 |
commit | 858fd1880ba5fffaacc9bac5c3cd9b0952819208 (patch) | |
tree | f1fc4dad2330a79f1632c3370b220f34cd0bc7f7 | |
parent | 21476ad16d3ca3687a474556c67d4789ef85a5df (diff) |
wifi: nl80211: hold wdev mutex in add/mod/del link station
Since we deal with links, and that requires looking at wdev links,
we should hold the wdev mutex for driver convenience.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r-- | net/wireless/nl80211.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 5f6cbc2d73b4..26d277c14fd4 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -15781,9 +15781,14 @@ nl80211_add_mod_link_station(struct sk_buff *skb, struct genl_info *info, if (err) return err; + wdev_lock(dev->ieee80211_ptr); if (add) - return rdev_add_link_station(rdev, dev, ¶ms); - return rdev_mod_link_station(rdev, dev, ¶ms); + err = rdev_add_link_station(rdev, dev, ¶ms); + else + err = rdev_mod_link_station(rdev, dev, ¶ms); + wdev_unlock(dev->ieee80211_ptr); + + return err; } static int @@ -15804,6 +15809,7 @@ nl80211_remove_link_station(struct sk_buff *skb, struct genl_info *info) struct link_station_del_parameters params = {}; struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct net_device *dev = info->user_ptr[1]; + int ret; if (!rdev->ops->del_link_station) return -EOPNOTSUPP; @@ -15815,7 +15821,11 @@ nl80211_remove_link_station(struct sk_buff *skb, struct genl_info *info) params.mld_mac = nla_data(info->attrs[NL80211_ATTR_MLD_ADDR]); params.link_id = nla_get_u8(info->attrs[NL80211_ATTR_MLO_LINK_ID]); - return rdev_del_link_station(rdev, dev, ¶ms); + wdev_lock(dev->ieee80211_ptr); + ret = rdev_del_link_station(rdev, dev, ¶ms); + wdev_unlock(dev->ieee80211_ptr); + + return ret; } #define NL80211_FLAG_NEED_WIPHY 0x01 |