Re: [PATCH] can: isotp: omit unintended hrtimer restart on socket release
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-19 21:36:09
Attachments
- signature.asc [application/pgp-signature] 488 bytes
From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2021-06-19 21:36:09
On 18.06.2021 19:37:13, Oliver Hartkopp wrote:
When closing the isotp socket the potentially running hrtimers are canceled before removing the subscription for CAN idendifiers via can_rx_unregister(). This may lead to an unintended (re)start of a hrtimer in isotp_rcv_cf() and isotp_rcv_fc() in the case that a CAN frame is received by isotp_rcv() while the subscription removal is processed. However, isotp_rcv() is called under RCU protection, so after calling can_rx_unregister, we may call synchronize_rcu in order to wait for any RCU read-side critical sections to finish. This prevents the reception of CAN frames after hrtimer_cancel() and therefore the unintended (re)start of the hrtimers. Signed-off-by: Oliver Hartkopp <socketcan@hartkopp.net>
Added to linux-can/testing Thanks, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung West/Dortmund | Phone: +49-231-2826-924 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |