Commit f971e188 authored by Johannes Berg's avatar Johannes Berg

nl80211: fix locking in nl80211_set_tx_bitrate_mask()

This accesses the wdev's chandef etc., so cannot safely
be used without holding the lock.
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
Link: https://lore.kernel.org/r/20220506102136.06b7205419e6.I2a87c05fbd8bc5e565e84d190d4cfd2e92695a90@changeidSigned-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 9e2db50f
...@@ -11666,18 +11666,23 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb, ...@@ -11666,18 +11666,23 @@ static int nl80211_set_tx_bitrate_mask(struct sk_buff *skb,
struct cfg80211_bitrate_mask mask; struct cfg80211_bitrate_mask mask;
struct cfg80211_registered_device *rdev = info->user_ptr[0]; struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct net_device *dev = info->user_ptr[1]; struct net_device *dev = info->user_ptr[1];
struct wireless_dev *wdev = dev->ieee80211_ptr;
int err; int err;
if (!rdev->ops->set_bitrate_mask) if (!rdev->ops->set_bitrate_mask)
return -EOPNOTSUPP; return -EOPNOTSUPP;
wdev_lock(wdev);
err = nl80211_parse_tx_bitrate_mask(info, info->attrs, err = nl80211_parse_tx_bitrate_mask(info, info->attrs,
NL80211_ATTR_TX_RATES, &mask, NL80211_ATTR_TX_RATES, &mask,
dev, true); dev, true);
if (err) if (err)
return err; goto out;
return rdev_set_bitrate_mask(rdev, dev, NULL, &mask); err = rdev_set_bitrate_mask(rdev, dev, NULL, &mask);
out:
wdev_unlock(wdev);
return err;
} }
static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info) static int nl80211_register_mgmt(struct sk_buff *skb, struct genl_info *info)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment