linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] cfg80211: update information elements in cached BSS struct
@ 2010-12-09 10:48 Sven Neumann
  2010-12-09 12:47 ` Johannes Berg
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Neumann @ 2010-12-09 10:48 UTC (permalink / raw)
  To: linux-wireless; +Cc: Sven Neumann

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>
---
 net/wireless/scan.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/net/wireless/scan.c b/net/wireless/scan.c
index 503ebb8..629bfaa 100644
--- a/net/wireless/scan.c
+++ b/net/wireless/scan.c
@@ -465,6 +465,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 			size_t used = dev->wiphy.bss_priv_size + sizeof(*res);
 			size_t ielen = res->pub.len_beacon_ies;
 
+                        int information_elements_is_beacon_ies =
+                                (found->pub.information_elements == found->pub.beacon_ies);
+
 			if (found->pub.beacon_ies &&
 			    !found->beacon_ies_allocated &&
 			    ksize(found) >= used + ielen) {
@@ -487,6 +490,11 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
 					found->pub.len_beacon_ies = ielen;
 				}
 			}
+
+                        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);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-12-09 14:07 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-09 10:48 [PATCH] cfg80211: update information elements in cached BSS struct Sven Neumann
2010-12-09 12:47 ` Johannes Berg
2010-12-09 13:17   ` Sven Neumann
2010-12-09 13:53     ` Johannes Berg
2010-12-09 14:05       ` Sven Neumann
2010-12-09 14:07         ` Johannes Berg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).