aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless
diff options
context:
space:
mode:
authorSven Neumann <s.neumann@raumfeld.com>2010-12-09 09:05:24 -0500
committerJohn W. Linville <linville@tuxdriver.com>2010-12-13 15:23:28 -0500
commit01123e233193a544c85b622e1690f44532052c5b (patch)
tree3632678a9441a2dce021f6a2ceada5de4e7e7e07 /net/wireless
parent998d516d9546eba04dd99ae49a78acb0cf770478 (diff)
cfg80211: update information elements in cached BSS struct
When a cached BSS struct is updated because a new beacon was received, the code replaces the cached information elements by the IEs from the new beacon. However it did not update the pub.information_elements and pub.len_information_elements fields leaving them either pointing to the old beacon IEs or in an inconsistent state where the data is replaced by the new beacon IEs but len_information_elements still has its value from the first beacon. Fix this by updating the information elements fields if they are pointing to beacon IEs. Signed-off-by: Sven Neumann <s.neumann@raumfeld.com> Reviewed-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/wireless')
-rw-r--r--net/wireless/scan.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 503ebb86ba18..ea427f418f64 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -464,6 +464,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
464 if (res->pub.beacon_ies) { 464 if (res->pub.beacon_ies) {
465 size_t used = dev->wiphy.bss_priv_size + sizeof(*res); 465 size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
466 size_t ielen = res->pub.len_beacon_ies; 466 size_t ielen = res->pub.len_beacon_ies;
467 bool information_elements_is_beacon_ies =
468 (found->pub.information_elements ==
469 found->pub.beacon_ies);
467 470
468 if (found->pub.beacon_ies && 471 if (found->pub.beacon_ies &&
469 !found->beacon_ies_allocated && 472 !found->beacon_ies_allocated &&
@@ -487,6 +490,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
487 found->pub.len_beacon_ies = ielen; 490 found->pub.len_beacon_ies = ielen;
488 } 491 }
489 } 492 }
493
494 /* Override IEs if they were from a beacon before */
495 if (information_elements_is_beacon_ies) {
496 found->pub.information_elements =
497 found->pub.beacon_ies;
498 found->pub.len_information_elements =
499 found->pub.len_beacon_ies;
500 }
490 } 501 }
491 502
492 kref_put(&res->ref, bss_release); 503 kref_put(&res->ref, bss_release);