FAILED: patch "[PATCH] wifi: mt76: take rcu_read_lock in the USB/SDIO tx completion path" failed to apply to 6.18-stable tree
Subsystems (3)
Sasha Levin
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 a7871a7ae5a8625f0ba0a89454ac734c383dd538
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From a7871a7ae5a8625f0ba0a89454ac734c383dd538 Mon Sep 17 00:00:00 2001
From: Devin Wittmayer <[email protected]>
Date: Sat, 3 Oct 2026 16:30:56 -0700
Subject: [PATCH] wifi: mt76: take rcu_read_lock in the USB/SDIO tx completion
path
The USB and SDIO completion path reads a station pointer that RCU protects, without holding the read lock. Lockdep catches it on the first association:
mt76.h:1305 suspicious rcu_dereference_check() usage! no locks held by mt76-usb-status/1254.
mt7925_usb_sdio_tx_complete_skb+0x119/0x130 [mt7925_common] mt76_queue_tx_complete+0x27/0x60 [mt76] mt76u_status_worker+0xed/0x1e0 [mt76_usb]
mt7925/mac.c:856 suspicious rcu_dereference_check() usage!
mt7925_tx_check_aggr.part.0+0xc2/0xe0 [mt7925_common] mt7925_usb_sdio_tx_complete_skb+0xa0/0x130 [mt7925_common]
mt7921 does the same, and warns once instead of twice because its aggregation check reads the default link directly. The DMA path makes the same reads but completes from softirq, so it stays quiet.
Take the read lock around the lookup and the check.
Tested on 7.2-rc5 with lockdep, fresh module load per arm, 4000 packets each and no change to the link:
splats before after
MT7925 Netgear A9000 2 0
MT7921 Alfa 1 0
mt7921e same kernel 0 0
--- drivers/net/wireless/mediatek/mt76/mt7921/mac.c | 3 +++ drivers/net/wireless/mediatek/mt76/mt7925/mac.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/net/wireless/mediatek/mt76/mt7921/mac.c +3 -0
@@ -831,11 +831,14 @@ void mt7921_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,u16 idx; idx =le32_get_bits (txwi[1 ],MT_TXD1_WLAN_IDX ); + +rcu_read_lock (); wcid =__mt76_wcid_ptr (mdev, idx); sta =wcid_to_sta (wcid);if (sta &&likely (e->skb->protocol !=cpu_to_be16 (ETH_P_PAE )))mt76_connac2_tx_check_aggr (sta, txwi); +rcu_read_unlock ();skb_pull (e->skb, headroom);mt76_tx_complete_skb (mdev, e->wcid, e->skb);
drivers/net/wireless/mediatek/mt76/mt7925/mac.c +3 -0
@@ -1687,11 +1687,14 @@ void mt7925_usb_sdio_tx_complete_skb(struct mt76_dev *mdev,u16 idx; idx =le32_get_bits (txwi[1 ],MT_TXD1_WLAN_IDX ); + +rcu_read_lock (); wcid =__mt76_wcid_ptr (mdev, idx); sta =wcid_to_sta (wcid);if (sta &&likely (e->skb->protocol !=cpu_to_be16 (ETH_P_PAE )))mt7925_tx_check_aggr (sta, e->skb, wcid); +rcu_read_unlock ();skb_pull (e->skb, headroom);mt76_tx_complete_skb (mdev, e->wcid, e->skb);
Signature · 1 line
2.53.0