Linux-mediatek Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Eason Lai (賴易聖)" <Eason.Lai@mediatek.com>
To: "JB Tsai (蔡志彬)" <Jb.Tsai@mediatek.com>,
	"nbd@nbd.name" <nbd@nbd.name>,
	"lorenzo@kernel.org" <lorenzo@kernel.org>
Cc: "Deren Wu (武德仁)" <Deren.Wu@mediatek.com>,
	"Ryder Lee" <Ryder.Lee@mediatek.com>,
	"Quan Zhou (周全)" <Quan.Zhou@mediatek.com>,
	"Litien Chang (張立典)" <Litien.Chang@mediatek.com>,
	"linux-wireless@vger.kernel.org" <linux-wireless@vger.kernel.org>,
	"Sean Wang" <Sean.Wang@mediatek.com>,
	"Leon Yen (顏良儒)" <Leon.Yen@mediatek.com>,
	"linux-mediatek@lists.infradead.org"
	<linux-mediatek@lists.infradead.org>
Subject: Re: [PATCH v3] wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete
Date: Mon, 13 Jul 2026 09:34:03 +0000	[thread overview]
Message-ID: <633ca22ae9b555102f8791289b1719313b82e43e.camel@mediatek.com> (raw)
In-Reply-To: <KL1PR03MB7079CDD6006DA83B2E0DD32D97E62@KL1PR03MB7079.apcprd03.prod.outlook.com>

On Mon, 2026-06-15 at 02:17 +0000, Eason Lai (賴易聖) wrote:
> After looking into the mac80211 STA removal flow, I didn't notice
> that synchronize_net() is invoked after mt76_sta_pre_rcu_remove().
> You are right. I will check mt7925_change_vif_links(). Thanks for the
> suggestion.
> 
> Best regards,
> Eason
> 
> -----Original Message-----
> From: Felix Fietkau <nbd@nbd.name> 
> Sent: Monday, June 1, 2026 7:13 PM
> To: JB Tsai (蔡志彬) <Jb.Tsai@mediatek.com>; lorenzo@kernel.org
> Cc: linux-wireless@vger.kernel.org;
> linux-mediatek@lists.infradead.org; Deren Wu (武德仁)
> <Deren.Wu@mediatek.com>; Sean Wang <Sean.Wang@mediatek.com>; Quan
> Zhou (周全) <Quan.Zhou@mediatek.com>; Ryder Lee
> <Ryder.Lee@mediatek.com>; Leon Yen (顏良儒) <Leon.Yen@mediatek.com>;
> Litien Chang (張立典) <Litien.Chang@mediatek.com>; Eason Lai (賴易聖)
> <Eason.Lai@mediatek.com>
> Subject: Re: [PATCH v3] wifi: mt76: mt792x: fix use-after-free in
> mt76_rx_poll_complete
> 
> On 06.05.26 10:43, JB Tsai wrote:
> > From: Eason Lai <Eason.Lai@mediatek.com>
> > 
> > A use-after-free issue occurs in mt76_rx_poll_complete due to a
> > race 
> > condition. The STA has already been removed, but the rx_status
> > still 
> > had a pointer to the wcid in the STA.
> > 
> > Use wcid_idx instead of storing the wcid pointer, and look up the
> > wcid 
> > via rcu_dereference() by wcid_idx.
> Unless I'm misreading something, it seems to me that this patch
> papers over a different bug instead of fixing the root cause.
> Right now the rx processing code relies on RCU to protect the wcid
> and sta data structures.
> The rcu lock/unlock around polling also seems correct to me.
> 
> Are the freed wcid pointers maybe related to a vif sta instead of an
> actual station? The use of devm_kfree in mt7925_change_vif_links
> looks suspicious to me.
> 
> Please let me know if I'm missing something here.
> 
> - Felix

The new patch is posted here:
https://lore.kernel.org/all/20260701010654.956863-1-eason.lai@mediatek.com/

Best regards,
Eason


      reply	other threads:[~2026-07-13  9:34 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-06  8:43 [PATCH v3] wifi: mt76: mt792x: fix use-after-free in mt76_rx_poll_complete JB Tsai
2026-06-01 11:12 ` Felix Fietkau
2026-06-15  2:17   ` Eason Lai (賴易聖)
2026-07-13  9:34     ` Eason Lai (賴易聖) [this message]

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=633ca22ae9b555102f8791289b1719313b82e43e.camel@mediatek.com \
    --to=eason.lai@mediatek.com \
    --cc=Deren.Wu@mediatek.com \
    --cc=Jb.Tsai@mediatek.com \
    --cc=Leon.Yen@mediatek.com \
    --cc=Litien.Chang@mediatek.com \
    --cc=Quan.Zhou@mediatek.com \
    --cc=Ryder.Lee@mediatek.com \
    --cc=Sean.Wang@mediatek.com \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=lorenzo@kernel.org \
    --cc=nbd@nbd.name \
    /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