Thread (9 messages) 9 messages, 4 authors, 2022-09-23

Re: [PATCH net 2/3] can: gs_usb: gs_can_open(): fix race dev->can.state condition

From: Marc Kleine-Budde <mkl@pengutronix.de>
Date: 2022-09-22 08:42:52
Also in: linux-can, mptcp

On 22.09.2022 10:04:55, Matthieu Baerts wrote:
On 21/09/2022 10:36, Marc Kleine-Budde wrote:
quoted
The dev->can.state is set to CAN_STATE_ERROR_ACTIVE, after the device
has been started. On busy networks the CAN controller might receive
CAN frame between and go into an error state before the dev->can.state
is assigned.

Assign dev->can.state before starting the controller to close the race
window.

Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/all/20220920195216.232481-1-mkl@pengutronix.de (local)
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
FYI, we got a small conflict when merging -net in net-next in the MPTCP
tree due to this patch applied in -net:

  5440428b3da6 ("can: gs_usb: gs_can_open(): fix race dev->can.state
condition")

and this one from net-next:

  45dfa45f52e6 ("can: gs_usb: add RX and TX hardware timestamp support")

The conflict has been resolved on our side[1] and the resolution we
suggest is attached to this email.
That patch looks good to me.

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 |

Attachments

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help