mirror of
https://github.com/torvalds/linux.git
synced 2026-11-07 06:17:02 +01:00
wifi: nl80211: avoid RTNL in nl80211_get_reg_do()
We don't need the RTNL here now, all the work can happen under RCU. Drop the RTNL and do it all under RCU instead. Link: https://patch.msgid.link/20261011113308.ef489f51e801.Iabc6383753a9e49ade17801c76fd5a91f7397475@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
parent
2a0abc320a
commit
98a19abc79
|
|
@ -11189,7 +11189,7 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
|
|||
if (!hdr)
|
||||
goto put_failure;
|
||||
|
||||
rtnl_lock();
|
||||
rcu_read_lock();
|
||||
|
||||
if (info->attrs[NL80211_ATTR_WIPHY]) {
|
||||
bool self_managed;
|
||||
|
|
@ -11204,44 +11204,37 @@ static int nl80211_get_reg_do(struct sk_buff *skb, struct genl_info *info)
|
|||
self_managed = wiphy->regulatory_flags &
|
||||
REGULATORY_WIPHY_SELF_MANAGED;
|
||||
|
||||
rcu_read_lock();
|
||||
|
||||
regdom = get_wiphy_regdom(wiphy);
|
||||
|
||||
/* a self-managed-reg device must have a private regdom */
|
||||
if (WARN_ON(!regdom && self_managed)) {
|
||||
err = -EINVAL;
|
||||
goto nla_put_failure_rcu;
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
if (regdom &&
|
||||
nla_put_u32(msg, NL80211_ATTR_WIPHY, get_wiphy_idx(wiphy)))
|
||||
goto nla_put_failure_rcu;
|
||||
} else {
|
||||
rcu_read_lock();
|
||||
goto nla_put_failure;
|
||||
}
|
||||
|
||||
if (!wiphy && reg_last_request_cell_base() &&
|
||||
nla_put_u32(msg, NL80211_ATTR_USER_REG_HINT_TYPE,
|
||||
NL80211_USER_REG_HINT_CELL_BASE))
|
||||
goto nla_put_failure_rcu;
|
||||
goto nla_put_failure;
|
||||
|
||||
if (!regdom)
|
||||
regdom = rcu_dereference(cfg80211_regdomain);
|
||||
|
||||
if (nl80211_put_regdom(regdom, msg))
|
||||
goto nla_put_failure_rcu;
|
||||
goto nla_put_failure;
|
||||
|
||||
rcu_read_unlock();
|
||||
|
||||
genlmsg_end(msg, hdr);
|
||||
rtnl_unlock();
|
||||
return genlmsg_reply(msg, info);
|
||||
|
||||
nla_put_failure_rcu:
|
||||
rcu_read_unlock();
|
||||
nla_put_failure:
|
||||
rtnl_unlock();
|
||||
rcu_read_unlock();
|
||||
put_failure:
|
||||
nlmsg_free(msg);
|
||||
return err;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user