summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorRameshkumar Sundaram <quic_ramess@quicinc.com>2022-04-11 14:37:51 +0530
committerJohannes Berg <johannes.berg@intel.com>2022-04-11 11:55:36 +0200
commita5199b5626cd6913cf8776a835bc63d40e0686ad (patch)
tree4b34baeeab52e73a8d54370be8c091d6a6aee703 /net
parent6624bb34b4eb19f715db9908cca00122748765d7 (diff)
downloadlinux-a5199b5626cd6913cf8776a835bc63d40e0686ad.tar.bz2
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: 0b8fb8235be8 ("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>
Diffstat (limited to 'net')
-rw-r--r--net/wireless/scan.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index b2fdac96bab0..4a6d86432910 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -2018,11 +2018,13 @@ cfg80211_inform_single_bss_data(struct wiphy *wiphy,
/* this is a nontransmitting bss, we need to add it to
* transmitting bss' list if it is not there
*/
+ spin_lock_bh(&rdev->bss_lock);
if (cfg80211_add_nontrans_list(non_tx_data->tx_bss,
&res->pub)) {
if (__cfg80211_unlink_bss(rdev, res))
rdev->bss_generation++;
}
+ spin_unlock_bh(&rdev->bss_lock);
}
trace_cfg80211_return_bss(&res->pub);