mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Cunhao Lu" <1579567540@qq.com>
To: netdev-bot+sashiko <netdev-bot+sashiko@kernel.org>
Cc: mkl <mkl@pengutronix.de>, mailhol <mailhol@kernel.org>,
	heiko <heiko@sntech.de>, davem <davem@davemloft.net>,
	wg <wg@grandegger.com>, socketcan <socketcan@hartkopp.net>,
	kernel <kernel@pengutronix.de>,
	linux-can <linux-can@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-arm-kernel <linux-arm-kernel@lists.infradead.org>,
	linux-rockchip <linux-rockchip@lists.infradead.org>,
	stable <stable@vger.kernel.org>, kuba <kuba@kernel.org>
Subject: Re: [PATCH net v5 1/6] can: dev: prevent bus-off recovery when the interface is not running
Date: Sat, 17 Oct 2026 11:27:03 +0800	[thread overview]
Message-ID: <tencent_AB234A019188927E4F4DAB34DF32E2091E08@qq.com> (raw)
In-Reply-To: <179219884173.1406898.3472467604167875171@kernel.org>

Hi,

> [Severity: Medium]
> Is this check enough to deliver what the subject line promises? It reads
> the running bit once without any lock. can_restart_work() runs on the
> system workqueue without RTNL or any CAN-private lock, so nothing orders
> it against __dev_close_many() and ndo_stop().

The check alone does not serialize restart with ndo_stop(), as noted in
the commit message. For Rockchip, this series also calls
close_candev_cancel_restart_sync() at the beginning of rkcanfd_stop(),
while the resources are still available, to wait for any restart that
has already passed the check before tearing down the hardware and IRQ.
The pre-existing teardown races in other drivers are outside the scope
of this series and should be addressed in separate patches.

> [Severity: High]
> This is a pre-existing issue and was not introduced by this patch. The
> patch makes the window smaller, but can restart_work still be queued
> after close_candev() has cancelled it?

Yes, if a bus-off producer is still running, the check does not prevent
it from queuing work after cancellation. For Rockchip, the series keeps
the final close_candev() after free_irq() has drained the bus-off
producer. This final cancellation catches work queued after the early
cancellation, and the running check prevents such work from restarting
the hardware while the interface is down.

The late-enqueue and lifetime issues in other drivers should also be
handled in separate patches. This series is limited to the Rockchip
CAN-FD restart/close races and does not add a generic free/unregister
safeguard.

Regards,
Cunhao Lu

  reply	other threads:[~2026-10-17  3:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-15  9:45 [PATCH net v5 0/6] can: fix bus-off restart and device close races Cunhao Lu via B4 Relay
2026-10-15  9:45 ` [PATCH net v5 1/6] can: dev: prevent bus-off recovery when the interface is not running Cunhao Lu via B4 Relay
2026-10-17  1:00   ` netdev-bot+sashiko
2026-10-17  3:27     ` Cunhao Lu [this message]
2026-10-15  9:45 ` [PATCH net v5 2/6] can: dev: add close_candev_cancel_restart_sync() Cunhao Lu via B4 Relay
2026-10-17  1:00   ` netdev-bot+sashiko
2026-10-17  3:42     ` Cunhao Lu
2026-10-15  9:45 ` [PATCH net v5 3/6] can: rockchip_canfd: cancel bus-off restart before closing the device Cunhao Lu via B4 Relay
2026-10-15  9:45 ` [PATCH net v5 4/6] can: rockchip_canfd: prevent timestamp work from rearming after bus-off Cunhao Lu via B4 Relay
2026-10-15  9:45 ` [PATCH net v5 5/6] can: rockchip_canfd: serialize TX with bus-off and restart Cunhao Lu via B4 Relay
2026-10-17  1:00   ` netdev-bot+sashiko
2026-10-17  3:54     ` Cunhao Lu
2026-10-15  9:45 ` [PATCH net v5 6/6] can: rockchip_canfd: serialize timecounter timestamp conversion Cunhao Lu via B4 Relay

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=tencent_AB234A019188927E4F4DAB34DF32E2091E08@qq.com \
    --to=1579567540@qq.com \
    --cc=davem@davemloft.net \
    --cc=heiko@sntech.de \
    --cc=kernel@pengutronix.de \
    --cc=kuba@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-can@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=mailhol@kernel.org \
    --cc=mkl@pengutronix.de \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=socketcan@hartkopp.net \
    --cc=stable@vger.kernel.org \
    --cc=wg@grandegger.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

all inboxes | Powered by JetHome®