Skip to content

Commit 9e2db50

Browse files
committed
mac80211_hwsim: call ieee80211_tx_prepare_skb under RCU protection
This is needed since it might use (and pass out) pointers to e.g. keys protected by RCU. Can't really happen here as the frames aren't encrypted, but we need to still adhere to the rules. Fixes: cacfddf ("mac80211_hwsim: initialize ieee80211_tx_info at hw_scan_work") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://lore.kernel.org/r/20220505230421.5f139f9de173.I77ae111a28f7c0e9fd1ebcee7f39dbec5c606770@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent a59d555 commit 9e2db50

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/net/wireless/mac80211_hwsim.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2478,18 +2478,21 @@ static void hw_scan_work(struct work_struct *work)
24782478
if (req->ie_len)
24792479
skb_put_data(probe, req->ie, req->ie_len);
24802480

2481+
rcu_read_lock();
24812482
if (!ieee80211_tx_prepare_skb(hwsim->hw,
24822483
hwsim->hw_scan_vif,
24832484
probe,
24842485
hwsim->tmp_chan->band,
24852486
NULL)) {
2487+
rcu_read_unlock();
24862488
kfree_skb(probe);
24872489
continue;
24882490
}
24892491

24902492
local_bh_disable();
24912493
mac80211_hwsim_tx_frame(hwsim->hw, probe,
24922494
hwsim->tmp_chan);
2495+
rcu_read_unlock();
24932496
local_bh_enable();
24942497
}
24952498
}

0 commit comments

Comments
 (0)