Linux wireless drivers development
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Yoni Divinsky <yoni.divinsky@ti.com>
Cc: linux-wireless@vger.kernel.org
Subject: Re: [PATCH] mac80211: fix tx->skb NULL pointer dereference
Date: Mon, 16 Jan 2012 13:21:32 +0100	[thread overview]
Message-ID: <1326716492.3510.10.camel@jlt3.sipsolutions.net> (raw)
In-Reply-To: <1326707004-3352-1-git-send-email-yoni.divinsky@ti.com> (sfid-20120116_104144_714044_0D0D9702)

On Mon, 2012-01-16 at 11:43 +0200, Yoni Divinsky wrote:
> In function ieee80211_tx_h_encrypt the var info was
> initialized from tx->skb, since the fucntion
> is called after the function ieee80211_tx_h_fragment
> tx->skb is not valid anymore.

Wow, that's quite a while ago, I guess nobody tests WAPI often? :-)

> @@ -1001,8 +1001,6 @@ ieee80211_tx_h_stats(struct ieee80211_tx_data *tx)
>  static ieee80211_tx_result debug_noinline
>  ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
>  {
> -	struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb);
> -
>  	if (!tx->key)
>  		return TX_CONTINUE;
>  
> @@ -1017,13 +1015,7 @@ ieee80211_tx_h_encrypt(struct ieee80211_tx_data *tx)
>  	case WLAN_CIPHER_SUITE_AES_CMAC:
>  		return ieee80211_crypto_aes_cmac_encrypt(tx);
>  	default:
> -		/* handle hw-only algorithm */
> -		if (info->control.hw_key) {
> -			ieee80211_tx_set_protected(tx);
> -			return TX_CONTINUE;
> -		}
> -		break;
> -
> +		return ieee80211_crypto_default_encrypt(tx);

How about
ieee80211_require_hw_crypto() or something like that?

> +ieee80211_tx_result
> +ieee80211_crypto_default_encrypt(struct ieee80211_tx_data *tx)
> +{
> +	struct sk_buff *skb;
> +	struct ieee80211_tx_info *info = NULL;
> +
> +	skb_queue_walk(&tx->skbs, skb) {
> +		info  = IEEE80211_SKB_CB(skb);
> +
> +		/* handle hw-only algorithm */
> +		if (info == NULL || !info->control.hw_key)
> +			return TX_DROP;

info == NULL can't happen

johannes


  reply	other threads:[~2012-01-16 12:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-16  9:43 [PATCH] mac80211: fix tx->skb NULL pointer dereference Yoni Divinsky
2012-01-16 12:21 ` Johannes Berg [this message]
2012-01-16 12:35   ` Divinsky, Yonatan

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=1326716492.3510.10.camel@jlt3.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=yoni.divinsky@ti.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