On 22.11.2024 23:15:45, Dario Binacchi wrote: > The commit a22bd630cfff ("can: hi311x: do not report txerr and rxerr > during bus-off") removed the reporting of rxerr and txerr even in case > of correct operation (i. e. not bus-off). The CAN frame is unnecessarily > set since netif_rx() has already been called. The patch fixes the issue > by postponing the netif_rx() call in case of txerr and rxerr reporting. re-phrased to: can: hi311x: hi3110_can_ist(): fix potential use-after-free The commit a22bd630cfff ("can: hi311x: do not report txerr and rxerr during bus-off") removed the reporting of rxerr and txerr even in case of correct operation (i. e. not bus-off). The error count information added to the CAN frame after netif_rx() is a potential use after free, since there is no guarantee that the skb is in the same state. It might be freed or reused. Fix the issue by postponing the netif_rx() call in case of txerr and rxerr reporting. > Fixes: a22bd630cfff ("can: hi311x: do not report txerr and rxerr during bus-off") > Signed-off-by: Dario Binacchi <dario.binacchi@xxxxxxxxxxxxxxxxxxxx> regards, Marc -- Pengutronix e.K. | Marc Kleine-Budde | Embedded Linux | https://www.pengutronix.de | Vertretung Nürnberg | Phone: +49-5121-206917-129 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |
Attachment:
signature.asc
Description: PGP signature