diff options
author | Johannes Berg <johannes.berg@intel.com> | 2023-09-19 09:40:52 +0300 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2023-09-25 10:00:39 +0300 |
commit | 6b348f6e34ce7dc5eb68066377d5e38780ce4095 (patch) | |
tree | 47613ba385c2a2fcfd787ca8925b2108cfbe2303 /net/mac80211/ethtool.c | |
parent | 5b43bd71f4942afa79b0683f4f41b1d47a21a9c7 (diff) | |
download | linux-6b348f6e34ce7dc5eb68066377d5e38780ce4095.tar.xz |
wifi: mac80211: ethtool: always hold wiphy mutex
Drivers should really be able to rely on the wiphy mutex
being held all the time, unless otherwise documented. For
ethtool, that wasn't quite right. Fix and clarify this in
both code and documentation.
Reported-by: syzbot+c12a771b218dcbba32e1@syzkaller.appspotmail.com
Fixes: 0e8185ce1dde ("wifi: mac80211: check wiphy mutex in ops")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/ethtool.c')
-rw-r--r-- | net/mac80211/ethtool.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/net/mac80211/ethtool.c b/net/mac80211/ethtool.c index 9894d2024470..99f6174a9d69 100644 --- a/net/mac80211/ethtool.c +++ b/net/mac80211/ethtool.c @@ -19,11 +19,16 @@ static int ieee80211_set_ringparam(struct net_device *dev, struct netlink_ext_ack *extack) { struct ieee80211_local *local = wiphy_priv(dev->ieee80211_ptr->wiphy); + int ret; if (rp->rx_mini_pending != 0 || rp->rx_jumbo_pending != 0) return -EINVAL; - return drv_set_ringparam(local, rp->tx_pending, rp->rx_pending); + wiphy_lock(local->hw.wiphy); + ret = drv_set_ringparam(local, rp->tx_pending, rp->rx_pending); + wiphy_unlock(local->hw.wiphy); + + return ret; } static void ieee80211_get_ringparam(struct net_device *dev, @@ -35,8 +40,10 @@ static void ieee80211_get_ringparam(struct net_device *dev, memset(rp, 0, sizeof(*rp)); + wiphy_lock(local->hw.wiphy); drv_get_ringparam(local, &rp->tx_pending, &rp->tx_max_pending, &rp->rx_pending, &rp->rx_max_pending); + wiphy_unlock(local->hw.wiphy); } static const char ieee80211_gstrings_sta_stats[][ETH_GSTRING_LEN] = { |