public inbox for linux-wireless@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mac80211: avoid NULL ptr deref when using WEP
@ 2010-01-22 17:39 John W. Linville
  2010-01-22 18:45 ` Johannes Berg
  2010-01-22 21:03 ` Kalle Valo
  0 siblings, 2 replies; 3+ messages in thread
From: John W. Linville @ 2010-01-22 17:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, John W. Linville

"mac80211: move control.hw_key assignment" changed an if-else into two
separate if statments, but the if-else is needed to prevent
dereferencing a null info->control.hw_key.  This fixes avoids a lock-up
during association on my machine when using WEP.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
---
 net/mac80211/wep.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 0a4c641..5d745f2 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -310,9 +310,8 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
 					  tx->key->conf.keylen,
 					  tx->key->conf.keyidx))
 			return -1;
-	}
-
-	if (info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
+	} else if (info->control.hw_key->flags &
+			IEEE80211_KEY_FLAG_GENERATE_IV) {
 		if (!ieee80211_wep_add_iv(tx->local, skb,
 					  tx->key->conf.keylen,
 					  tx->key->conf.keyidx))
-- 
1.6.2.5


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: avoid NULL ptr deref when using WEP
  2010-01-22 17:39 [PATCH] mac80211: avoid NULL ptr deref when using WEP John W. Linville
@ 2010-01-22 18:45 ` Johannes Berg
  2010-01-22 21:03 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Johannes Berg @ 2010-01-22 18:45 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless

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

On Fri, 2010-01-22 at 12:39 -0500, John W. Linville wrote:
> "mac80211: move control.hw_key assignment" changed an if-else into two
> separate if statments, but the if-else is needed to prevent
> dereferencing a null info->control.hw_key.  This fixes avoids a lock-up
> during association on my machine when using WEP.

Indeed, good catch, wonder how I arrived at that code.

johannes

> Signed-off-by: John W. Linville <linville@tuxdriver.com>
> ---
>  net/mac80211/wep.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
> index 0a4c641..5d745f2 100644
> --- a/net/mac80211/wep.c
> +++ b/net/mac80211/wep.c
> @@ -310,9 +310,8 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
>  					  tx->key->conf.keylen,
>  					  tx->key->conf.keyidx))
>  			return -1;
> -	}
> -
> -	if (info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
> +	} else if (info->control.hw_key->flags &
> +			IEEE80211_KEY_FLAG_GENERATE_IV) {
>  		if (!ieee80211_wep_add_iv(tx->local, skb,
>  					  tx->key->conf.keylen,
>  					  tx->key->conf.keyidx))


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

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mac80211: avoid NULL ptr deref when using WEP
  2010-01-22 17:39 [PATCH] mac80211: avoid NULL ptr deref when using WEP John W. Linville
  2010-01-22 18:45 ` Johannes Berg
@ 2010-01-22 21:03 ` Kalle Valo
  1 sibling, 0 replies; 3+ messages in thread
From: Kalle Valo @ 2010-01-22 21:03 UTC (permalink / raw)
  To: John W. Linville; +Cc: linux-wireless, johannes

"John W. Linville" <linville@tuxdriver.com> writes:

> "mac80211: move control.hw_key assignment" changed an if-else into two
> separate if statments, but the if-else is needed to prevent
> dereferencing a null info->control.hw_key.  This fixes avoids a lock-up
> during association on my machine when using WEP.

Thanks. I was also suffering from this and your patch fixed it.

> Signed-off-by: John W. Linville <linville@tuxdriver.com>

Tested-by: Kalle Valo <kalle.valo@iki.fi>

-- 
Kalle Valo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-01-22 21:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-01-22 17:39 [PATCH] mac80211: avoid NULL ptr deref when using WEP John W. Linville
2010-01-22 18:45 ` Johannes Berg
2010-01-22 21:03 ` Kalle Valo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox