All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Sven Neumann <s.neumann@raumfeld.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] cfg80211: update information elements in cached BSS struct
Date: Thu, 09 Dec 2010 15:07:07 +0100	[thread overview]
Message-ID: <1291903627.3540.9.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1291903524-8000-1-git-send-email-s.neumann@raumfeld.com>

On Thu, 2010-12-09 at 15:05 +0100, Sven Neumann wrote:
> 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>

> ---
>  net/wireless/scan.c |   11 +++++++++++
>  1 files changed, 11 insertions(+), 0 deletions(-)
> 
> diff --git a/net/wireless/scan.c b/net/wireless/scan.c
> index 503ebb8..ea427f4 100644
> --- a/net/wireless/scan.c
> +++ b/net/wireless/scan.c
> @@ -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 &&
> @@ -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);



      reply	other threads:[~2010-12-09 14:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1291903627.3540.9.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=s.neumann@raumfeld.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.