[lvc-project] [PATCH RESEND v4] can: j1939: cancel all pending ECUs on device stop
Oleksij Rempel
o.rempel at pengutronix.de
Fri Nov 27 12:40:52 MSK 2026
Hi Dmitry,
thank you, and sorry for the long silence.
On Thu, Nov 26, 2026 at 11:22:57AM +0300, Dmitry Antipov wrote:
> + if (hrtimer_try_to_cancel(&ecu->ac_timer) != -1)
> + j1939_ecu_put(ecu);
Unless I am missing something, hrtimer_try_to_cancel() returns 0 for an
inactive timer, so this drops a reference the timer does not hold.
> + j1939_ecu_cancel_all(priv);
> kref_put_mutex(&priv->rx_kref, __j1939_rx_release,
> &j1939_netdev_lock);
As far as I can see, j1939_netdev_stop() runs for every closed bound
socket, not only the last one. So this would also cancel address claims
of other sockets and remote ECUs. And an address claim received after
the cancel can still arm a new timer.
If I read the code right, the leak is the reference that
j1939_ecu_map_locked() takes when the timer fires after
j1939_ecu_unmap_all(). Tetsuo's v15 2/3 stops exactly this, without
cancelling anything:
https://lore.kernel.org/all/f778db47-a217-448e-9dbd-f1860afab00b@I-love.SAKURA.ne.jp/
So I would not take this patch. Could you please test the whole v15
series with your syzbot reproducer and reply there, ideally with a
Tested-by? If v15 does not fix your leak, or I overlooked something,
please let me know.
Regards,
Oleksij
More information about the lvc-project
mailing list