From: Greg KH on
2.6.35-stable review patch. If anyone has any objections, please let us know.


From: Johannes Berg <johannes.berg(a)>

commit ccb6c1360f8dd43303c659db718e7e0b24175db5 upstream.

When kernel-internal users use cfg80211_get_bss()
to get a reference to a BSS struct, they may end
up getting one that would have been removed from
the list if there had been any userspace access
to the list. This leads to inconsistencies and

Fix it by making cfg80211_get_bss() ignore BSSes
that cfg80211_bss_expire() would remove.


Reported-by: Jiajia Zheng <jiajia.zheng(a)>
Tested-by: Jiajia Zheng <jiajia.zheng(a)>
Signed-off-by: Johannes Berg <johannes.berg(a)>
Signed-off-by: John W. Linville <linville(a)>
Signed-off-by: Greg Kroah-Hartman <gregkh(a)>

net/wireless/scan.c | 5 +++++
1 file changed, 5 insertions(+)

--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -275,6 +275,7 @@ struct cfg80211_bss *cfg80211_get_bss(st
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss, *res = NULL;
+ unsigned long now = jiffies;


@@ -283,6 +284,10 @@ struct cfg80211_bss *cfg80211_get_bss(st
if (channel && bss-> != channel)
+ /* Don't get expired BSS structs */
+ if (time_after(now, bss->ts + IEEE80211_SCAN_RESULT_EXPIRE) &&
+ !atomic_read(&bss->hold))
+ continue;
if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
res = bss;

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo(a)
More majordomo info at
Please read the FAQ at