Re: [PATCH net v10 05/10] can: rockchip_canfd: cancel bus-off restart before closing the device

From: netdev-bot+sashiko

Date: Fri Nov 20 2026 - 19:02:39 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message says late restart work (queued by a bus-off
IRQ after the early close_candev_cancel_restart_sync() in…

--

can: rockchip_canfd: cancel bus-off restart before closing the device

This patch adds a call to close_candev_cancel_restart_sync() at the start
of rkcanfd_stop(), so that a running bus-off restart is cancelled while
the IRQ, RX offload and controller are still available. Echo cleanup and
the final restart cancellation stay in close_candev().

> A bus-off IRQ can pass the scheduling check before close, then queue
> restart work after the early cancellation. The final cancellation after
> free_irq() drains that late work so it cannot survive close.

[Severity: Low]
Is this explanation complete? Late-queued restart work does not have to
wait for the final cancel. With a short restart_ms it can run anywhere
between the early cancel and close_candev().

That window covers rkcanfd_chip_interrupts_disable(), free_irq(),
can_rx_offload_disable() and rkcanfd_chip_stop_sync(). The final
cancel_delayed_work_sync() in close_candev() can't undo a restart that
has already run there.

In that window, only this check in can_restart() stops the restart:

drivers/net/can/dev/dev.c:can_restart() {
...
if (!netif_running(dev))
return -ENETDOWN;
...
}

Without that check, the work would reach rkcanfd_set_mode():

case CAN_MODE_START:
rkcanfd_chip_start(priv);
rkcanfd_chip_interrupts_enable(priv);
netif_wake_queue(ndev);

That check, and the "scheduling check" in can_bus_off():

restart = priv->restart_ms && netif_running(dev);

both come from the earlier patch in this series, "can: dev: check
netif_running() before bus-off recovery".

Neither the commit message nor the Cc: stable tag names that dependency.
The patch only needs "can: dev: add close_candev_cancel_restart_sync()"
to build. So a backport that takes this patch and the helper, but not
the netif_running() patch, would build cleanly and still have the
restart-after-teardown race.

Could the commit message say that late work which runs before the final
cancel is stopped by the netif_running() check in can_restart()? Could
the netif_running() patch also be listed as a stable prerequisite?

> diff --git a/drivers/net/can/rockchip/rockchip_canfd-core.c b/drivers/net/can/rockchip/rockchip_canfd-core.c
> index 1cae86973da5a..59a79fe057e66 100644
> --- a/drivers/net/can/rockchip/rockchip_canfd-core.c
> +++ b/drivers/net/can/rockchip/rockchip_canfd-core.c
> @@ -758,6 +758,7 @@ static int rkcanfd_stop(struct net_device *ndev)
> {
> struct rkcanfd_priv *priv = netdev_priv(ndev);
>
> + close_candev_cancel_restart_sync(ndev);
> netif_stop_queue(ndev);
>
> rkcanfd_chip_interrupts_disable(priv);

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261119-rockchip-canfd-restart-close-v10-0-df23913aa33a%40qq.com