Skip to content

Commit

Permalink
cfg80211: update information elements in cached BSS struct
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sven Neumann authored and John W. Linville committed Dec 13, 2010
1 parent 998d516 commit 01123e2
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions net/wireless/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
if (res->pub.beacon_ies) {
size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
size_t ielen = res->pub.len_beacon_ies;
bool information_elements_is_beacon_ies =
(found->pub.information_elements ==
found->pub.beacon_ies);

if (found->pub.beacon_ies &&
!found->beacon_ies_allocated &&
Expand All @@ -487,6 +490,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
found->pub.len_beacon_ies = ielen;
}
}

/* Override IEs if they were from a beacon before */
if (information_elements_is_beacon_ies) {
found->pub.information_elements =
found->pub.beacon_ies;
found->pub.len_information_elements =
found->pub.len_beacon_ies;
}
}

kref_put(&res->ref, bss_release);
Expand Down

0 comments on commit 01123e2

Please sign in to comment.