]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
cfg80211: hold bss_lock while updating nontrans_list
authorRameshkumar Sundaram <quic_ramess@quicinc.com>
Mon, 11 Apr 2022 09:07:51 +0000 (14:37 +0530)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:42:17 +0000 (14:42 +0200)
BugLink: https://bugs.launchpad.net/bugs/1969857
[ Upstream commit a5199b5626cd6913cf8776a835bc63d40e0686ad ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
net/wireless/scan.c

index 8e1e578d64bc0882b9c3fd2a42276bf0a8988700..1a8b76c9dd567a0e7d698202eae78a03cffc3fdb 100644 (file)
@@ -1978,11 +1978,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);