From: sashiko-bot@kernel.org
To: phucduc.bui@gmail.com
Cc: imx@lists.linux.dev, Frank.Li@kernel.org
Subject: Re: [PATCH net-next v6 1/2] net: fec: Propagate PTP initialization errors
Date: Sat, 12 Sep 2026 04:03:23 +0000 [thread overview]
Message-ID: <20260912040323.EED7A1F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260911040021.12289-1-phucduc.bui@gmail.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Unsafe error paths leave the devm-managed PPS IRQ active while hardware clocks are disabled and `ndev` is freed.
--
commit 4a112d5fbd55881d0083cd7c88b9d35cd673b462
Author: bui duc phuc <phucduc.bui@gmail.com>
net: fec: Propagate PTP initialization errors
This commit changes fec_ptp_init() to return an error code instead of
silently ignoring failures during PTP initialization. It also propagates
failures from devm_request_irq() and ptp_clock_register().
Link: https://lore.kernel.org/all/20260909064712.22539-1-phucduc.bui@gmail.com/
> diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
[ ... ]
> @@ -5384,8 +5384,11 @@ fec_probe(struct platform_device *pdev)
> goto failed_reset;
>
> irq_cnt = fec_enet_get_irq_cnt(pdev);
> - if (fep->bufdesc_ex)
> - fec_ptp_init(pdev, irq_cnt);
> + if (fep->bufdesc_ex) {
> + ret = fec_ptp_init(pdev, irq_cnt);
> + if (ret)
> + goto failed_reset;
[Severity: High]
This isn't a bug introduced by this patch, but this new error path exposes a
pre-existing issue.
If fec_ptp_init() fails (for example, when ptp_clock_register() returns an
error), we jump straight to failed_reset. At this point, the PPS interrupt
has already been requested via devm_request_irq() inside fec_ptp_init().
The cleanup path under failed_reset disables hardware clocks (clk_ahb,
clk_ipg) and eventually frees ndev. Since the devm-managed IRQ is not freed
until fec_probe() returns, the interrupt remains active during this cleanup.
If a pending PPS interrupt fires during this window, fec_pps_interrupt()
will access hardware registers with clocks disabled and dereference the
freed ndev memory. Could this lead to a kernel panic or use-after-free
during a probe failure?
> + }
>
> ret = fec_enet_init(ndev);
> if (ret)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260911040021.12289-1-phucduc.bui@gmail.com?part=1
prev parent reply other threads:[~2026-09-12 4:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-11 4:00 [PATCH net-next v6 1/2] net: fec: Propagate PTP initialization errors phucduc.bui
2026-09-11 4:00 ` [PATCH net-next v6 2/2] net: fec: Handle optional IRQ lookup errors correctly phucduc.bui
2026-09-12 4:03 ` sashiko-bot
2026-09-12 4:03 ` sashiko-bot [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=20260912040323.EED7A1F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=Frank.Li@kernel.org \
--cc=imx@lists.linux.dev \
--cc=phucduc.bui@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
/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