Netdev List
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: 赵金明 <zhaojinming@uniontech.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
	andrew+netdev <andrew+netdev@lunn.ch>,
	davem <davem@davemloft.net>, edumazet <edumazet@google.com>,
	kuba <kuba@kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	"madalin.bucur" <madalin.bucur@nxp.com>,
	netdev <netdev@vger.kernel.org>, pabeni <pabeni@redhat.com>,
	"sean.anderson" <sean.anderson@linux.dev>
Subject: Re: [PATCH v3] net: fman: fix use-after-free on IRQF_SHARED handler after probe failure
Date: Fri, 26 Jun 2026 17:23:23 +0100	[thread overview]
Message-ID: <20260626162323.GE1310988@horms.kernel.org> (raw)
In-Reply-To: <A2160E1BFD1B78E6+202606261753007787241@uniontech.com>

On Fri, Jun 26, 2026 at 05:53:02PM +0800, 赵金明 wrote:
> Hi,
> 
> The analysis is logically correct. Since fman is zero-initialized by
> kzalloc_obj(), both fman->cfg and fman->fpm_regs are NULL when
> devm_request_irq() registers the shared IRQ handler. The guard in
> fman_irq():
> 
>     if (!is_init_done(fman->cfg))
>         return IRQ_NONE;
> 
> does not protect against this case because is_init_done(NULL) returns
> true, so the handler would proceed to dereference the NULL
> fpm_regs pointer via ioread32be().
> 
> However, this is a pre-existing issue unrelated to the UAF fix in this
> patch. The window is very short -- between devm_request_irq() and the
> completion of fman_init() -- and would require another device on the
> same shared IRQ line to fire an interrupt during that interval.
> 
> If this should be addressed, I will send a separate patch for it.
> The current patch is focused solely on the post-IRQ-registration UAF
> on error paths.
> 
> Please let me know if you would like me to handle this separately.

Thanks, I agree this can be handled separately.

  reply	other threads:[~2026-06-26 16:23 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-18  7:54 [PATCH] net: fman: fix clock and device node leak in probe error paths ZhaoJinming
2026-06-18  8:08 ` Madalin Bucur
2026-06-19 12:13 ` Simon Horman
2026-06-22  9:05   ` [PATCH v2 1/2] net: fman: fix clk reference leak in read_dts_node() ZhaoJinming
2026-06-22  9:05     ` [PATCH v2 2/2] net: fman: use devm_kzalloc() for fman and rely on devres ZhaoJinming
2026-06-22 10:36       ` Andrew Lunn
2026-06-23  6:16         ` 赵金明
2026-06-23 11:22           ` Andrew Lunn
2026-06-24  9:49             ` ZhaoJinming
2026-06-24  9:49               ` [PATCH v3] net: fman: fix use-after-free on IRQF_SHARED handler after probe failure ZhaoJinming
2026-06-25 16:42                 ` Simon Horman
2026-06-26  9:53                   ` 赵金明
2026-06-26 16:23                     ` Simon Horman [this message]
2026-06-22 10:33     ` [PATCH v2 1/2] net: fman: fix clk reference leak in read_dts_node() Andrew Lunn

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=20260626162323.GE1310988@horms.kernel.org \
    --to=horms@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=andrew@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madalin.bucur@nxp.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=sean.anderson@linux.dev \
    --cc=zhaojinming@uniontech.com \
    /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