diff options
author | Benjamin Berg <benjamin.berg@intel.com> | 2023-06-15 15:28:32 +0300 |
---|---|---|
committer | iwlwifi publisher <> | 2023-06-15 18:51:17 +0000 |
commit | 9769e256f7d029da42e243ece27eab318749ae11 (patch) | |
tree | 5961fa843f6e9db2915f9c9006c76e9d2600a336 | |
parent | e45f901d4283603366d85de4cd0442ada4e97517 (diff) | |
download | backport-iwlwifi-9769e256f7d029da42e243ece27eab318749ae11.tar.gz |
[BUGFIX] wifi: mac80211: fix lockdep issue when building TLDS mgmt frames
The function ieee80211_tdls_build_mgmt_packet_data may be called without
the sdata lock held. As such, avoid using sdata_dereference and instead
take the RCU read lock and use rcu_dereference.
This warning happened when called as from:
* ieee80211_tdls_build_mgmt_packet_data
* ieee80211_tdls_prep_mgmt_packet
* ieee80211_tdls_mgmt
* nl80211_tdls_mgmt
type=bugfix
ticket=none
fixes=Ie773c5679805001f5a52680d68d9ce0232c57648
Change-Id: I51336ea2c583a77e9af840fd4340c88291557791
Signed-off-by: Benjamin Berg <benjamin.berg@intel.com>
Reviewed-on: https://gerritwcs.ir.intel.com/c/iwlwifi-stack-dev/+/60697
automatic-review: iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
tested: iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
Reviewed-by: Greenman, Gregory <gregory.greenman@intel.com>
Tested-by: iil_jenkins <EC.GER.UNIX.IIL.JENKINS@INTEL.COM>
x-iwlwifi-stack-dev: b0cdde40a0bd145c160030d154b46f81da2bfcac
-rw-r--r-- | net/mac80211/tdls.c | 10 | ||||
-rw-r--r-- | versions | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c index 87e41133be..b6ba1c0b6e 100644 --- a/net/mac80211/tdls.c +++ b/net/mac80211/tdls.c @@ -956,9 +956,10 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, struct ieee80211_link_data *link; link_id = link_id >= 0 ? link_id : 0; - link = sdata_dereference(sdata->link[link_id], sdata); + rcu_read_lock(); + link = rcu_dereference(sdata->link[link_id]); if (WARN_ON(!link)) - return NULL; + goto unlock; skb = netdev_alloc_skb(sdata->dev, local->hw.extra_tx_headroom + @@ -985,7 +986,7 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, extra_ies_len + sizeof(struct ieee80211_tdls_lnkie)); if (!skb) - return NULL; + goto unlock; skb_reserve(skb, local->hw.extra_tx_headroom); @@ -1019,10 +1020,13 @@ ieee80211_tdls_build_mgmt_packet_data(struct ieee80211_sub_if_data *sdata, ieee80211_tdls_add_ies(link, skb, peer, action_code, status_code, initiator, extra_ies, extra_ies_len, oper_class, chandef); + rcu_read_unlock(); return skb; fail: dev_kfree_skb(skb); +unlock: + rcu_read_unlock(); return NULL; } @@ -2,4 +2,4 @@ BACKPORTS_VERSION="(see git)" BACKPORTED_KERNEL_VERSION="(see git)" BACKPORTED_KERNEL_NAME="iwlwifi" BACKPORTS_BUILD_TSTAMP=__DATE__ \" \" __TIME__ -BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:11299:77d3b64a" +BACKPORTS_GIT_TRACKED="iwlwifi-stack-public:master:11300:b0cdde40" |