Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: greearb@candelatech.com
Cc: linux-wireless@vger.kernel.org
Subject: Re: [RFC 2/2] wireless:  Make sure __cfg80211_connect_result always puts bss.
Date: Tue, 18 Jun 2013 14:19:38 +0200	[thread overview]
Message-ID: <1371557978.8318.10.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1371515281-26879-2-git-send-email-greearb@candelatech.com> (sfid-20130618_022822_882338_7451297B)

On Mon, 2013-06-17 at 17:28 -0700, greearb@candelatech.com wrote:
> From: Ben Greear <greearb@candelatech.com>
> 
> Otherwise, we can leak a bss reference.
> 
> Signed-off-by: Ben Greear <greearb@candelatech.com>
> ---
>  net/wireless/sme.c |   11 +++++++++--
>  1 files changed, 9 insertions(+), 2 deletions(-)
> 
> diff --git a/net/wireless/sme.c b/net/wireless/sme.c
> index 6066720..ea2ce33 100644
> --- a/net/wireless/sme.c
> +++ b/net/wireless/sme.c
> @@ -420,6 +420,7 @@ void cfg80211_sme_failed_assoc(struct wireless_dev *wdev)
>  	schedule_work(&rdev->conn_work);
>  }
>  
> +/** This method must consume bss one way or another */
>  void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
>  			       const u8 *req_ie, size_t req_ie_len,
>  			       const u8 *resp_ie, size_t resp_ie_len,
> @@ -435,11 +436,17 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
>  	ASSERT_WDEV_LOCK(wdev);
>  
>  	if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
> -		    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
> +		    wdev->iftype != NL80211_IFTYPE_P2P_CLIENT)) {
> +		if (bss)
> +			cfg80211_put_bss(wdev->wiphy, bss);
>  		return;
> +	}

This is reasonable, though it'd be stupid to call it in this case, I'm
not worried about leaking when the warning triggers.

> -	if (wdev->sme_state != CFG80211_SME_CONNECTING)
> +	if (wdev->sme_state != CFG80211_SME_CONNECTING) {
> +		if (bss)
> +			cfg80211_put_bss(wdev->wiphy, bss);
>  		return;
> +	}

This code doesn't exist any more.

johannes


  reply	other threads:[~2013-06-18 12:19 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-18  0:28 [RFC 1/2] mac80211: Stop timer before deleting data structures greearb
2013-06-18  0:28 ` [RFC 2/2] wireless: Make sure __cfg80211_connect_result always puts bss greearb
2013-06-18 12:19   ` Johannes Berg [this message]
2013-06-18 12:14 ` [RFC 1/2] mac80211: Stop timer before deleting data structures Johannes Berg

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=1371557978.8318.10.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=greearb@candelatech.com \
    --cc=linux-wireless@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox