Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Tomas Winkler <tomas.winkler@intel.com>
Cc: linville@tuxdriver.com, yi.zhu@intel.com,
	linux-wireless@vger.kernel.org,
	Emmanuel Grumbach <emmanuel.grumbach@intel.com>
Subject: Re: [PATCH 1/1] mac80211: fix an oops in several failure paths in key allocation
Date: Thu, 26 Jun 2008 15:24:26 +0200	[thread overview]
Message-ID: <1214486666.20763.40.camel@johannes.berg> (raw)
In-Reply-To: <1214471626-4231-1-git-send-email-tomas.winkler@intel.com>

[-- Attachment #1: Type: text/plain, Size: 1231 bytes --]

On Thu, 2008-06-26 at 12:13 +0300, Tomas Winkler wrote:
> From: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> 
> This patch fixes an oops in several failure paths in key allocation. This
> Oops occurs when freeing a key that has not been linked yet, so the
> key->sdata is not set.
> 
> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>

Acked-by: Johannes Berg <johannes@sipsolutions.net>

> ---
>  net/mac80211/key.c |    9 +++++++++
>  1 files changed, 9 insertions(+), 0 deletions(-)
> 
> diff --git a/net/mac80211/key.c b/net/mac80211/key.c
> index d4893bd..6597c77 100644
> --- a/net/mac80211/key.c
> +++ b/net/mac80211/key.c
> @@ -387,6 +387,15 @@ void ieee80211_key_free(struct ieee80211_key *key)
>  	if (!key)
>  		return;
>  
> +	if (!key->sdata) {
> +		/* The key has not been linked yet, simply free it
> +		 * and don't Oops */
> +		if (key->conf.alg == ALG_CCMP)
> +			ieee80211_aes_key_free(key->u.ccmp.tfm);
> +		kfree(key);
> +		return;
> +	}
> +
>  	spin_lock_irqsave(&key->sdata->local->key_lock, flags);
>  	__ieee80211_key_free(key);
>  	spin_unlock_irqrestore(&key->sdata->local->key_lock, flags);

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

      reply	other threads:[~2008-06-26 13:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-26  9:13 [PATCH 1/1] mac80211: fix an oops in several failure paths in key allocation Tomas Winkler
2008-06-26 13:24 ` 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=1214486666.20763.40.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=emmanuel.grumbach@intel.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=linville@tuxdriver.com \
    --cc=tomas.winkler@intel.com \
    --cc=yi.zhu@intel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox