linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mattias Nissler <mattias.nissler@gmx.de>
To: Johannes Berg <johannes@sipsolutions.net>
Cc: linux-wireless@vger.kernel.org, rt2400-devel@lists.sourceforge.net
Subject: [PATCH] mac80211: Defer setting of RX_FLAG_DECRYPTED.
Date: Sun, 07 Oct 2007 16:35:31 +0200	[thread overview]
Message-ID: <1191767731.8135.5.camel@localhost> (raw)

The decryption handlers will skip the frame if the RX_FLAG_DECRYPTED
flag is set, so the early flag setting introduced by Johannes breaks
decryption. To work around this, call the handlers first and then set
the flag.

Signed-off-by: Mattias Nissler <mattias.nissler@gmx.de>
---
 net/mac80211/rx.c |   20 +++++++++++---------
 1 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index de3f7ae..34699a1 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -424,6 +424,7 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
 	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) rx->skb->data;
 	int keyidx;
 	int hdrlen;
+	ieee80211_txrx_result result = TXRX_DROP;
 	struct ieee80211_key *stakey = NULL;
 
 	/*
@@ -522,21 +523,22 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
 	    ieee80211_wep_is_weak_iv(rx->skb, rx->key))
 		rx->sta->wep_weak_iv_count++;
 
-	/* either the frame will be decrypted or dropped */
-	rx->u.rx.status->flag |= RX_FLAG_DECRYPTED;
-
 	switch (rx->key->conf.alg) {
 	case ALG_WEP:
-		return ieee80211_crypto_wep_decrypt(rx);
+		result = ieee80211_crypto_wep_decrypt(rx);
+		break;
 	case ALG_TKIP:
-		return ieee80211_crypto_tkip_decrypt(rx);
+		result = ieee80211_crypto_tkip_decrypt(rx);
+		break;
 	case ALG_CCMP:
-		return ieee80211_crypto_ccmp_decrypt(rx);
+		result = ieee80211_crypto_ccmp_decrypt(rx);
+		break;
 	}
 
-	/* not reached */
-	WARN_ON(1);
-	return TXRX_DROP;
+	/* either the frame will be decrypted or dropped */
+	rx->u.rx.status->flag |= RX_FLAG_DECRYPTED;
+
+	return result;
 }
 
 static void ap_sta_ps_start(struct net_device *dev, struct sta_info *sta)
-- 
1.5.3


             reply	other threads:[~2007-10-07 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-07 14:35 Mattias Nissler [this message]
2007-10-07 14:53 ` [PATCH] mac80211: Defer setting of RX_FLAG_DECRYPTED Michael Buesch
2007-10-07 15:05   ` Mattias Nissler
2007-10-09 20:12     ` Johannes Berg
2007-10-10 21:07       ` Mattias Nissler
2007-10-08  9:34 ` Johannes Berg
2007-10-09  9:12   ` 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=1191767731.8135.5.camel@localhost \
    --to=mattias.nissler@gmx.de \
    --cc=johannes@sipsolutions.net \
    --cc=linux-wireless@vger.kernel.org \
    --cc=rt2400-devel@lists.sourceforge.net \
    /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;
as well as URLs for NNTP newsgroup(s).