FAILED: patch "[PATCH] wifi: mt76: mt7996: bound the device EEPROM address before" failed to apply to 6.18-stable tree
Subsystems (3)
[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 13b3c29a782033ce4a230be9e5618032813dbcd4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090414-routine-poster-2605@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 13b3c29a782033ce4a230be9e5618032813dbcd4 Mon Sep 17 00:00:00 2001
From: Bryam Vargas <[email protected]>
Date: Thu, 25 Jun 2026 07:10:27 -0500
Subject: [PATCH] wifi: mt76: mt7996: bound the device EEPROM address before
the EFUSE copy
mt7996_mcu_get_eeprom() derives the destination of the EFUSE/EXT block copy from the address reported by the MCU response (event->addr, a device-controlled __le32) and clamps only the copy length, never the destination offset into dev->mt76.eeprom.data. A malicious or malfunctioning device can report an arbitrary address and drive an out-of-bounds write of up to MT7996_EXT_EEPROM_BLOCK_SIZE bytes past eeprom.data.
Reject a response whose address would place the copy outside eeprom.data before deriving the destination pointer. Devices that echo the requested in-bounds offset are unaffected.
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +8 -1
@@ -4352,11 +4352,18 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *buf, u32 buf_l event = (struct mt7996_mcu_eeprom_access_event *)skb->data;if (event->valid) {u32 ret_len =le32_to_cpu (event->eeprom.ext_eeprom.data_len); +u32 block = mode ==EEPROM_MODE_EXT ?MT7996_EXT_EEPROM_BLOCK_SIZE : +MT7996_EEPROM_BLOCK_SIZE ; addr =le32_to_cpu (event->addr); -if (!buf) +if (!buf) { +if (addr > dev->mt76.eeprom.size - block) { +dev_kfree_skb (skb); +return -EINVAL ; + } buf = (u8 *)dev->mt76.eeprom.data + addr; + }switch (mode) {case EEPROM_MODE_EFUSE :
Sasha Levin
maintainerPATCH 1/2 wifi: mt76: mt7996: bound the device EEPROM address before the EFUSE copy
From: Bryam Vargas <[email protected]>
[ Upstream commit 13b3c29a782033ce4a230be9e5618032813dbcd4 ]
mt7996_mcu_get_eeprom() derives the destination of the EFUSE/EXT block copy from the address reported by the MCU response (event->addr, a device-controlled __le32) and clamps only the copy length, never the destination offset into dev->mt76.eeprom.data. A malicious or malfunctioning device can report an arbitrary address and drive an out-of-bounds write of up to MT7996_EXT_EEPROM_BLOCK_SIZE bytes past eeprom.data.
Reject a response whose address would place the copy outside eeprom.data before deriving the destination pointer. Devices that echo the requested in-bounds offset are unaffected.
--- drivers/net/wireless/mediatek/mt76/mt7996/mcu.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/mt7996/mcu.c +7 -1
@@ -3866,8 +3866,14 @@ int mt7996_mcu_get_eeprom(struct mt7996_dev *dev, u32 offset, u8 *buf, u32 buf_lif (valid) {u32 addr =le32_to_cpu (*(__le32 *)(skb->data +12 )); -if (!buf) +if (!buf) { +if (addr > dev->mt76.eeprom.size - +MT7996_EEPROM_BLOCK_SIZE ) { +dev_kfree_skb (skb); +return -EINVAL ; + } buf = (u8 *)dev->mt76.eeprom.data + addr; + }if (!buf_len || buf_len >MT7996_EEPROM_BLOCK_SIZE ) buf_len =MT7996_EEPROM_BLOCK_SIZE ;
Signature · 1 line
2.53.0