UPSTREAM: wifi: nl80211: hold wdev mutex for channel switch APIs

Since we deal with links in an MLD here, hold the wdev
mutex now.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>

Bug: 253289327
Change-Id: I4025ae8a2a3a206fe0bf7c1051bbbbec6df71943
(cherry picked from commit 4e2f3d67e3afef751e1ad81c6b156f2aafa25dcf)
Signed-off-by: Kiran Kumar Lokere <quic_klokere@quicinc.com>
This commit is contained in:
Johannes Berg
2022-06-20 15:28:50 +02:00
committed by Todd Kjos
parent 7f076a74a7
commit 80f8155cfc

View File

@@ -3338,8 +3338,13 @@ static int nl80211_set_channel(struct sk_buff *skb, struct genl_info *info)
struct cfg80211_registered_device *rdev = info->user_ptr[0];
int link_id = nl80211_link_id_or_invalid(info->attrs);
struct net_device *netdev = info->user_ptr[1];
int ret;
return __nl80211_set_channel(rdev, netdev, info, link_id);
wdev_lock(netdev->ieee80211_ptr);
ret = __nl80211_set_channel(rdev, netdev, info, link_id);
wdev_unlock(netdev->ieee80211_ptr);
return ret;
}
static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
@@ -3451,10 +3456,16 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
}
if (info->attrs[NL80211_ATTR_WIPHY_FREQ]) {
result = __nl80211_set_channel(
rdev,
nl80211_can_set_dev_channel(wdev) ? netdev : NULL,
info, -1);
if (wdev) {
wdev_lock(wdev);
result = __nl80211_set_channel(
rdev,
nl80211_can_set_dev_channel(wdev) ? netdev : NULL,
info, -1);
wdev_unlock(wdev);
} else {
result = __nl80211_set_channel(rdev, netdev, info, -1);
}
if (result)
goto out;
}