FAILED: patch "[PATCH] wifi: libipw: reject TKIP frames without a full MIC" failed to apply to 6.18-stable tree
[email protected]
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x 06f42accaf3c6aecab1dcc57f68dde6c06c8b380
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092231-good-mahogany-cb59@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 06f42accaf3c6aecab1dcc57f68dde6c06c8b380 Mon Sep 17 00:00:00 2001
From: Daehyeon Ko <[email protected]>
Date: Wed, 9 Sep 2026 15:11:24 +0900
Subject: [PATCH] wifi: libipw: reject TKIP frames without a full MIC
libipw_michael_mic_verify() assumes that an skb contains an eight-byte Michael MIC. A short TKIP frame makes the unsigned payload length wrap, causing michael_mic() to read past the skb.
Check that the MIC is present before verifying it, and use the existing MICHAEL_MIC_LEN constant for all MIC lengths in the verifier.
drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c +7 -5
@@ -474,14 +474,16 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, int hdr_len, void *priv) { struct libipw_tkip_data *tkey = priv; -u8 mic[8 ]; +u8 mic[MICHAEL_MIC_LEN ]; -if (!tkey->key_set) +if (!tkey->key_set || skb->len < hdr_len +MICHAEL_MIC_LEN )return -1 ;michael_mic (&tkey->key[24 ], (struct ieee80211_hdr *)skb->data, - skb->data + hdr_len, skb->len -8 - hdr_len, mic); -if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) { + skb->data + hdr_len, + skb->len -MICHAEL_MIC_LEN - hdr_len, mic); +if (memcmp (mic, skb->data + skb->len -MICHAEL_MIC_LEN , +MICHAEL_MIC_LEN ) !=0 ) {struct ieee80211_hdr *hdr; hdr = (struct ieee80211_hdr *)skb->data; printk(KERN_DEBUG "%s: Michael MIC verification failed for "
@@ -499,7 +501,7 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; -skb_trim (skb, skb->len -8 ); +skb_trim (skb, skb->len -MICHAEL_MIC_LEN );return 0 ; }
Sasha Levin
maintainerPATCH 1/4 wifi: ipw2x00: Rename michael_mic() to libipw_michael_mic()
From: Eric Biggers <[email protected]>
[ Upstream commit ea06baf59bd4b83c2cb13698411909e5e6be001e ]
Rename the driver-local michael_mic() function to libipw_michael_mic() to prevent a name conflict with the common michael_mic() function.
Note that this code will be superseded later when libipw starts using the common michael_mic(). This commit just prevents a bisection hazard.
Stable-dep-of: 06f42accaf3c ("wifi: libipw: reject TKIP frames without a full MIC")
--- drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c +3 -3
@@ -464,7 +464,7 @@ static int libipw_tkip_decrypt(struct sk_buff *skb, int hdr_len, void *priv)return keyidx; } -static int michael_mic (struct crypto_shash *tfm_michael,u8 *key,u8 *hdr, +static int libipw_michael_mic (struct crypto_shash *tfm_michael,u8 *key,u8 *hdr,u8 *data,size_t data_len,u8 *mic) {SHASH_DESC_ON_STACK (desc, tfm_michael);
@@ -546,7 +546,7 @@ static int libipw_michael_mic_add(struct sk_buff *skb, int hdr_len,michael_mic_hdr (skb, tkey->tx_hdr); pos =skb_put (skb,8 ); -if (michael_mic (tkey->tx_tfm_michael, &tkey->key[16 ], tkey->tx_hdr, +if (libipw_michael_mic (tkey->tx_tfm_michael, &tkey->key[16 ], tkey->tx_hdr, skb->data + hdr_len, skb->len -8 - hdr_len, pos))return -1 ;
@@ -584,7 +584,7 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx,return -1 ;michael_mic_hdr (skb, tkey->rx_hdr); -if (michael_mic (tkey->rx_tfm_michael, &tkey->key[24 ], tkey->rx_hdr, +if (libipw_michael_mic (tkey->rx_tfm_michael, &tkey->key[24 ], tkey->rx_hdr, skb->data + hdr_len, skb->len -8 - hdr_len, mic))return -1 ;if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 2/4 wifi: mac80211, cfg80211: Export michael_mic() and move it to cfg80211
From: Eric Biggers <[email protected]>
[ Upstream commit 613c83766884503f0f6bfdc45964c84b5286091c ]
Export michael_mic() so that the ath11k and ath12k drivers can call it. In addition, move it from mac80211 to cfg80211 so that the ipw2x00 drivers, which depend on cfg80211 but not mac80211, can also call it.
Currently these drivers have their own local implementations of michael_mic() based on crypto_shash, which is redundant and inefficient. By consolidating all the Michael MIC code into cfg80211, we'll be able to remove the duplicate Michael MIC code in the crypto/ directory.
Stable-dep-of: 06f42accaf3c ("wifi: libipw: reject TKIP frames without a full MIC")
---
include/linux/ieee80211.h | 5 +++++
net/mac80211/Makefile | 1 -
net/mac80211/michael.h | 22 -------------------
net/mac80211/wpa.c | 1 -
net/wireless/Makefile | 2 +-
.../michael.c => wireless/michael-mic.c} | 5 ++++-
6 files changed, 10 insertions(+), 26 deletions(-)
delete mode 100644 net/mac80211/michael.h
rename net/{mac80211/michael.c => wireless/michael-mic.c} (96%)include/linux/ieee80211.h +5 -0
@@ -2249,6 +2249,11 @@ enum ieee80211_radio_measurement_actioncode {#define PMK_MAX_LEN 64#define SAE_PASSWORD_MAX_LEN 128 +#define MICHAEL_MIC_LEN 8 + +void michael_mic (const u8 *key,struct ieee80211_hdr *hdr, +const u8 *data,size_t data_len,u8 *mic); +/* Public action codes (IEEE Std 802.11-2016, 9.6.8.1, Table 9-307) */ enum ieee80211_pub_actioncode {WLAN_PUB_ACTION_20_40_BSS_COEX =0 ,
net/mac80211/Makefile +0 -1
@@ -18,7 +18,6 @@ mac80211-y := \ iface.o \ link.o \ rate.o \ - michael.o \ tkip.o \ aes_cmac.o \ aes_gmac.o \
net/mac80211/michael.h deleted +0 -22
@@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* -* Michael MIC implementation - optimized for TKIP MIC operations -* Copyright 2002-2003, Instant802 Networks, Inc. -*/ - -#ifndef MICHAEL_H -#define MICHAEL_H - -#include <linux/types.h> -#include <linux/ieee80211.h> - -#define MICHAEL_MIC_LEN 8 - -struct michael_mic_ctx { -u32 l, r; -}; - -void michael_mic (const u8 *key,struct ieee80211_hdr *hdr, -const u8 *data,size_t data_len,u8 *mic); - -#endif /* MICHAEL_H */
net/mac80211/wpa.c +0 -1
@@ -18,7 +18,6 @@#include <crypto/utils.h> #include "ieee80211_i.h" -#include "michael.h" #include "tkip.h" #include "aes_ccm.h" #include "aes_cmac.h"
net/wireless/Makefile +1 -1
@@ -8,7 +8,7 @@ obj-$(CONFIG_WEXT_PRIV) += wext-priv.o cfg80211-y += core.o sysfs.o radiotap.o util.o reg.o scan.o nl80211.o cfg80211-y += mlme.o ibss.o sme.o chan.o ethtool.o mesh.o ap.o trace.o ocb.o -cfg80211-y += pmsr.o +cfg80211-y += michael-mic.o pmsr.o cfg80211-$(CONFIG_OF) += of.o cfg80211-$(CONFIG_CFG80211_DEBUGFS) += debugfs.o cfg80211-$(CONFIG_CFG80211_WEXT) += wext-compat.o wext-sme.o
net/wireless/michael-mic.c renamed from net/mac80211/michael.c +4 -1
@@ -8,7 +8,9 @@#include <linux/ieee80211.h> #include <linux/unaligned.h> -#include "michael.h" +struct michael_mic_ctx { +u32 l, r; +};static void michael_block (struct michael_mic_ctx *mctx,u32 val) {
@@ -81,3 +83,4 @@ void michael_mic(const u8 *key, struct ieee80211_hdr *hdr,put_unaligned_le32 (mctx.l, mic);put_unaligned_le32 (mctx.r, mic +4 ); } +EXPORT_SYMBOL_GPL (michael_mic);
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 3/4 wifi: ipw2x00: Use michael_mic() from cfg80211
In reply to Sasha LevinFrom: Eric Biggers <[email protected]>
[ Upstream commit 32a0e1c63cdfaa9a6f1405b552b5f9eb2be61c59 ]
Just use the michael_mic() function from cfg80211 instead of a local implementation of it using the crypto_shash API.
Stable-dep-of: 06f42accaf3c ("wifi: libipw: reject TKIP frames without a full MIC")
--- drivers/net/wireless/intel/ipw2x00/Kconfig | 1 - .../intel/ipw2x00/libipw_crypto_tkip.c | 120 +----------------- 2 files changed, 5 insertions(+), 116 deletions(-)
drivers/net/wireless/intel/ipw2x00/Kconfig +0 -1
@@ -154,7 +154,6 @@ config LIBIPW depends on PCI && CFG80211 select WIRELESS_EXT select CRYPTO - select CRYPTO_MICHAEL_MIC select CRYPTO_LIB_ARC4 select CRC32 help
drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c +5 -115
177 lines not on this page · raw message
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 4/4 wifi: libipw: reject TKIP frames without a full MIC
In reply to Sasha LevinFrom: Daehyeon Ko <[email protected]>
[ Upstream commit 06f42accaf3c6aecab1dcc57f68dde6c06c8b380 ]
libipw_michael_mic_verify() assumes that an skb contains an eight-byte Michael MIC. A short TKIP frame makes the unsigned payload length wrap, causing michael_mic() to read past the skb.
Check that the MIC is present before verifying it, and use the existing MICHAEL_MIC_LEN constant for all MIC lengths in the verifier.
--- .../net/wireless/intel/ipw2x00/libipw_crypto_tkip.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)
drivers/net/wireless/intel/ipw2x00/libipw_crypto_tkip.c +7 -5
@@ -474,14 +474,16 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, int hdr_len, void *priv) { struct libipw_tkip_data *tkey = priv; -u8 mic[8 ]; +u8 mic[MICHAEL_MIC_LEN ]; -if (!tkey->key_set) +if (!tkey->key_set || skb->len < hdr_len +MICHAEL_MIC_LEN )return -1 ;michael_mic (&tkey->key[24 ], (struct ieee80211_hdr *)skb->data, - skb->data + hdr_len, skb->len -8 - hdr_len, mic); -if (memcmp (mic, skb->data + skb->len -8 ,8 ) !=0 ) { + skb->data + hdr_len, + skb->len -MICHAEL_MIC_LEN - hdr_len, mic); +if (memcmp (mic, skb->data + skb->len -MICHAEL_MIC_LEN , +MICHAEL_MIC_LEN ) !=0 ) {struct ieee80211_hdr *hdr; hdr = (struct ieee80211_hdr *)skb->data; printk(KERN_DEBUG "%s: Michael MIC verification failed for "
@@ -499,7 +501,7 @@ static int libipw_michael_mic_verify(struct sk_buff *skb, int keyidx, tkey->rx_iv32 = tkey->rx_iv32_new; tkey->rx_iv16 = tkey->rx_iv16_new; -skb_trim (skb, skb->len -8 ); +skb_trim (skb, skb->len -MICHAEL_MIC_LEN );return 0 ; }
Signature · 1 line
2.53.0