diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-06-06 14:49:24 +0200 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-06-07 19:53:13 +0200 |
commit | 4d45145ba6e2e1c0eba4ebda7d6273319191f4e8 (patch) | |
tree | 1c003b34c56b77dfbc1b980d7cc8caab70e2f013 /net/wireless/core.c | |
parent | 7d2d0ff49dfdb38ad37baa9a27c0132d5e51a923 (diff) | |
download | linux-stable-4d45145ba6e2e1c0eba4ebda7d6273319191f4e8.tar.gz linux-stable-4d45145ba6e2e1c0eba4ebda7d6273319191f4e8.tar.bz2 linux-stable-4d45145ba6e2e1c0eba4ebda7d6273319191f4e8.zip |
wifi: cfg80211: hold wiphy lock when sending wiphy
Sending the wiphy out might cause calls to the driver,
notably get_txq_stats() and get_antenna(). These aren't
very important, since the normally have their own locks
and/or just send out static data, but if the contract
should be that the wiphy lock is always held, these are
also affected. Fix that.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/core.c')
-rw-r--r-- | net/wireless/core.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/net/wireless/core.c b/net/wireless/core.c index a04b6eeb55f8..151a8567d2a5 100644 --- a/net/wireless/core.c +++ b/net/wireless/core.c @@ -129,6 +129,7 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, int result; ASSERT_RTNL(); + lockdep_assert_wiphy(&rdev->wiphy); /* Ignore nop renames */ if (strcmp(newname, wiphy_name(&rdev->wiphy)) == 0) @@ -195,6 +196,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, continue; nl80211_notify_iface(rdev, wdev, NL80211_CMD_DEL_INTERFACE); } + + wiphy_lock(&rdev->wiphy); nl80211_notify_wiphy(rdev, NL80211_CMD_DEL_WIPHY); wiphy_net_set(&rdev->wiphy, net); @@ -203,6 +206,8 @@ int cfg80211_switch_netns(struct cfg80211_registered_device *rdev, WARN_ON(err); nl80211_notify_wiphy(rdev, NL80211_CMD_NEW_WIPHY); + wiphy_unlock(&rdev->wiphy); + list_for_each_entry(wdev, &rdev->wiphy.wdev_list, list) { if (!wdev->netdev) continue; @@ -941,8 +946,10 @@ int wiphy_register(struct wiphy *wiphy) rdev->wiphy.features |= NL80211_FEATURE_SCAN_FLUSH; rtnl_lock(); + wiphy_lock(&rdev->wiphy); res = device_add(&rdev->wiphy.dev); if (res) { + wiphy_unlock(&rdev->wiphy); rtnl_unlock(); return res; } @@ -956,6 +963,7 @@ int wiphy_register(struct wiphy *wiphy) cfg80211_debugfs_rdev_add(rdev); nl80211_notify_wiphy(rdev, NL80211_CMD_NEW_WIPHY); + wiphy_unlock(&rdev->wiphy); /* set up regulatory info */ wiphy_regulatory_register(wiphy); |