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] mac80211:  Ensure tid_start_tx is protected by sta->lock.
Date: Wed, 12 Jun 2013 22:47:03 +0200	[thread overview]
Message-ID: <1371070023.8601.36.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1371068409-10407-1-git-send-email-greearb@candelatech.com> (sfid-20130612_222023_756658_E80BFC74)

On Wed, 2013-06-12 at 13:20 -0700, greearb@candelatech.com wrote:

> I believe this is more correct, though it did not fix the
> memory leak I was chasing when I found this code.

That description could use some work :-)

> +		spin_lock_bh(&sta->lock);
> +
>  		tid_tx = sta->ampdu_mlme.tid_start_tx[tid];
>  		if (tid_tx) {
>  			/*
>  			 * Assign it over to the normal tid_tx array
>  			 * where it "goes live".
>  			 */
> -			spin_lock_bh(&sta->lock);
>  
>  			sta->ampdu_mlme.tid_start_tx[tid] = NULL;
>  			/* could there be a race? */
> @@ -301,6 +302,8 @@ void ieee80211_ba_session_work(struct work_struct *work)
>  
>  			ieee80211_tx_ba_session_handle_start(sta, tid);
>  			continue;
> +		} else {
> +			spin_unlock_bh(&sta->lock);
>  		}
>  

You could just put the unlock after the if block, given the continue in
it, I think I'd prefer that.

>  		tid_tx = rcu_dereference_protected_tid_tx(sta, tid);
> diff --git a/net/mac80211/sta_info.h b/net/mac80211/sta_info.h
> index c509423..0f85418 100644
> --- a/net/mac80211/sta_info.h
> +++ b/net/mac80211/sta_info.h
> @@ -204,6 +204,7 @@ struct tid_ampdu_rx {
>   *	driver requested to close until the work for it runs
>   * @mtx: mutex to protect all TX data (except non-NULL assignments
>   *	to tid_tx[idx], which are protected by the sta spinlock)
> + *      tid_start_tx is also protected by sta->lock.

That should be a tab.

johannes


      reply	other threads:[~2013-06-12 20:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 20:20 [RFC] mac80211: Ensure tid_start_tx is protected by sta->lock greearb
2013-06-12 20:47 ` 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=1371070023.8601.36.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