Skip to contentSkip to conversation

b43: Always drop crypt-failed packets.

PATCH New Michael Buesch 1 participant 1 message Sep 4, 2007 Networking drivers (wireless)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 b43: Always drop crypt-failed packets.

Drop packets for which the firmware was unable to decrypt it, as we won't be able to decrypt them with the key, too.

drivers/net/wireless/b43/xmit.c +8 -2
Index: wireless-dev/drivers/net/wireless/b43/xmit.c
===================================================================
@@ -465,6 +465,12 @@ void b43_rx(struct b43_wldev *dev, struc
 
 	if (macstat & B43_RX_MAC_FCSERR)
 		dev->wl->ieee_stats.dot11FCSErrorCount++;
+	if (macstat & B43_RX_MAC_DECERR) {
+		/* Decryption with the given key failed.
+		 * Drop the packet. We also won't be able to decrypt it with
+		 * the key in software. */
+		goto drop;
+	}
 
 	/* Skip PLCP and padding */
 	padding = (macstat & B43_RX_MAC_PADDING) ? 2 : 0;
@@ -483,7 +489,7 @@ void b43_rx(struct b43_wldev *dev, struc
 	fctl = le16_to_cpu(wlhdr->frame_control);
 	skb_trim(skb, skb->len - FCS_LEN);
 
-	if ((macstat & B43_RX_MAC_DEC) && !(macstat & B43_RX_MAC_DECERR)) {
+	if (macstat & B43_RX_MAC_DEC) {
 		unsigned int keyidx;
 		int wlhdr_len;
 		int iv_len;
@@ -573,7 +579,7 @@ void b43_rx(struct b43_wldev *dev, struc
 	ieee80211_rx_irqsafe(dev->wl->hw, skb, &status);
 
 	return;
-      drop:
+drop:
 	b43dbg(dev->wl, "RX: Packet dropped\n");
 	dev_kfree_skb_any(skb);
 }