Skip to content

Commit a5199b5

Browse files
Rameshkumar Sundaramjmberg-intel
authored andcommitted
cfg80211: hold bss_lock while updating nontrans_list
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 <quic_ramess@quicinc.com> Link: https://lore.kernel.org/r/1649668071-9370-1-git-send-email-quic_ramess@quicinc.com Signed-off-by: Johannes Berg <johannes.berg@intel.com>
1 parent 6624bb3 commit a5199b5

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

net/wireless/scan.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2018,11 +2018,13 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
20182018
/* this is a nontransmitting bss, we need to add it to
20192019
* transmitting bss' list if it is not there
20202020
*/
2021+
spin_lock_bh(&rdev->bss_lock);
20212022
if (cfg80211_add_nontrans_list(non_tx_data->tx_bss,
20222023
&res->pub)) {
20232024
if (__cfg80211_unlink_bss(rdev, res))
20242025
rdev->bss_generation++;
20252026
}
2027+
spin_unlock_bh(&rdev->bss_lock);
20262028
}
20272029

20282030
trace_cfg80211_return_bss(&res->pub);

0 commit comments

Comments
 (0)