From: sashiko-bot@kernel.org
To: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org,
wsa+renesas@sang-engineering.com, robh@kernel.org
Subject: Re: [PATCH net-next v5 03/10] net: ethernet: ravb: Simplify gPTP start and stop
Date: Tue, 22 Sep 2026 17:51:39 +0000 [thread overview]
Message-ID: <20260922175139.9B3471F00898@smtp.kernel.org> (raw)
In-Reply-To: <20260921175037.4084310-4-niklas.soderlund+renesas@ragnatech.se>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] ravb: PTP clock resource leak and Use-After-Free on DMA stop timeout
- [Medium] ravb: PTP timestamping broken after TX timeout recovery
--
commit bd55489575ec22549ad9bb8e730d4b498b5d08a1
Author: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
net: ethernet: ravb: Simplify gPTP start and stop
This patch reorganizes the initialization and teardown of the gPTP clock
for different device generations. It moves ravb_ptp_init() into
ravb_dmac_init() and ravb_ptp_stop() into ravb_stop_dma() for Gen2 devices.
> diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
> index a89f6fe7866fe..42d208e6b8ecd 100644
> --- a/drivers/net/ethernet/renesas/ravb_main.c
> +++ b/drivers/net/ethernet/renesas/ravb_main.c
[ ... ]
> @@ -1115,6 +1123,10 @@ static int ravb_stop_dma(struct net_device *ndev)
> netdev_err(ndev, "failed to stop AXI BUS\n");
> }
>
> + /* Stop PTP Clock driver */
> + if (info->gptp)
> + ravb_ptp_stop(ndev);
> +
[Severity: High]
If ravb_stop_dma() returns early due to a hardware timeout:
ravb_stop_dma() {
...
error = ravb_wait(ndev, TCCR, info->tccr_mask, 0);
if (error)
return error;
...
}
This relocated ravb_ptp_stop() call is skipped. Since ravb_close() ignores
failures from ravb_stop_dma() and proceeds to free the device structures,
will this leave the PTP clock device leaked and tied to soon-to-be-freed
memory, potentially causing a use-after-free when the module is removed?
> /* Stop AVB-DMAC process */
> return ravb_set_opmode(ndev, CCC_OPC_CONFIG);
> }
[ ... ]
> @@ -2056,10 +2058,6 @@ static void ravb_tx_timeout_work(struct work_struct *work)
> ravb_emac_init(ndev);
>
> out:
> - /* Initialise PTP Clock driver */
> - if (info->gptp)
> - ravb_ptp_init(ndev, priv->pdev);
> -
> netif_tx_start_all_queues(ndev);
>
> out_unlock:
[Severity: Medium]
When ravb_stop_dma() fails late (for example, if ravb_set_opmode() returns
an error at the end of the function), the PTP clock will have already been
stopped by the new code in ravb_stop_dma() above.
If this happens during ravb_tx_timeout_work(), the code jumps to the 'out'
label to safely resume queues, skipping ravb_dmac_init(). Since
ravb_ptp_init() is now folded inside ravb_dmac_init(), doesn't this leave
the PTP clock permanently disabled and break timestamping until the
interface is manually restarted?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260921175037.4084310-1-niklas.soderlund+renesas@ragnatech.se?part=3
next prev parent reply other threads:[~2026-09-22 17:51 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-21 17:50 [PATCH net-next v5 00/10] ravb: Add gPTP support for Gen4 Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 01/10] net: ethernet: ravb: Remove gPTP control from WoL setup and restore Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 02/10] net: ethernet: ravb: Move programming of gPTP timer interval Niklas Söderlund
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 03/10] net: ethernet: ravb: Simplify gPTP start and stop Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot [this message]
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 04/10] net: ethernet: ravb: Remove redundant argument to ravb_ptp_init() Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 05/10] net: ethernet: ravb: Propagate error from ptp_clock_register() Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 06/10] net: ethernet: ravb: Replace gPTP flags with callbacks Niklas Söderlund
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-21 17:50 ` [PATCH net-next v5 07/10] net: ethernet: ravb: Add callback for gPTP probe Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 08/10] net: ethernet: ravb: Add callback for gPTP clock index Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 09/10] dt-bindings: net: renesas,etheravb: Add optional gPTP phandle for Gen4 Niklas Söderlund
2026-09-21 17:50 ` [PATCH net-next v5 10/10] net: ethernet: ravb: Add gPTP support " Niklas Söderlund
2026-09-22 17:51 ` sashiko-bot
2026-09-24 11:51 ` netdev-bot+sashiko
2026-09-25 23:45 ` [PATCH net-next v5 00/10] " Jakub Kicinski
2026-09-25 23:50 ` patchwork-bot+netdevbpf
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=20260922175139.9B3471F00898@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=wsa+renesas@sang-engineering.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.