Skip to content

Commit 5a52384

Browse files
Rameshkumar Sundaramgregkh
Rameshkumar Sundaram
authored andcommitted
cfg80211: hold bss_lock while updating nontrans_list
[ Upstream commit a5199b5 ] Synchronize additions to nontrans_list of transmitting BSS with bss_lock to avoid races. Also when cfg80211_add_nontrans_list() fails __cfg80211_unlink_bss() needs bss_lock to be held (has lockdep assert on bss_lock). So protect the whole block with bss_lock to avoid races and warnings. Found during code review. Fixes: 0b8fb82 ("cfg80211: Parsing of Multiple BSSID information in scanning") Signed-off-by: Rameshkumar Sundaram <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent d5be67e commit 5a52384

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/wireless/scan.c

+2
Original file line numberDiff line numberDiff line change
@@ -1978,11 +1978,13 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
19781978
/* this is a nontransmitting bss, we need to add it to
19791979
* transmitting bss' list if it is not there
19801980
*/
1981+
spin_lock_bh(&rdev->bss_lock);
19811982
if (cfg80211_add_nontrans_list(non_tx_data->tx_bss,
19821983
&res->pub)) {
19831984
if (__cfg80211_unlink_bss(rdev, res))
19841985
rdev->bss_generation++;
19851986
}
1987+
spin_unlock_bh(&rdev->bss_lock);
19861988
}
19871989

19881990
trace_cfg80211_return_bss(&res->pub);

0 commit comments

Comments
 (0)