Skip to content

Commit 3207390

Browse files
jmberg-intellinvjw
authored andcommitted
cfg80211: fix BSS double-unlinking
When multiple interfaces are actively trying to associate with the same BSS, they may both find that the BSS isn't there and then try to unlink it. This can cause errors since the unlinking code can't currently deal with items that have already been unlinked. Normally this doesn't happen as most people don't try to use multiple station interfaces that associate at the same time too. Fix this by using the list entry as a flag to see if the item is still on a list. Cc: stable@kernel.org Reported-by: Ben Greear <greearb@candelatech.com> Tested-by: Hun-Kyi Wynn <hkwynn@candelatech.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
1 parent b206b4e commit 3207390

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

‎net/wireless/scan.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -650,14 +650,14 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
650650
bss = container_of(pub, struct cfg80211_internal_bss, pub);
651651

652652
spin_lock_bh(&dev->bss_lock);
653+
if (!list_empty(&bss->list)) {
654+
list_del_init(&bss->list);
655+
dev->bss_generation++;
656+
rb_erase(&bss->rbn, &dev->bss_tree);
653657

654-
list_del(&bss->list);
655-
dev->bss_generation++;
656-
rb_erase(&bss->rbn, &dev->bss_tree);
657-
658+
kref_put(&bss->ref, bss_release);
659+
}
658660
spin_unlock_bh(&dev->bss_lock);
659-
660-
kref_put(&bss->ref, bss_release);
661661
}
662662
EXPORT_SYMBOL(cfg80211_unlink_bss);
663663

0 commit comments

Comments
 (0)