Re: [RFC PATCH v1] can: gs_usb: change active_channels's type from atomic_t to u8

From: Marc Kleine-Budde
Date: Tue Feb 15 2022 - 03:13:33 EST


On 15.02.2022 08:48:14, Vincent Mailhol wrote:
> The driver uses an atomic_t variable: gs_usb:active_channels to keep
> track of the number of opened channels in order to only allocate
> memory for the URBs when this count changes from zero to one.
>
> However, the driver does not decrement the counter when an error
> occurs in gs_can_open(). This issue is fixed by changing the type from
> atomic_t to u8 and by simplifying the logic accordingly.
>
> It is safe to use an u8 here because the network stack big kernel lock
> (a.k.a. rtnl_mutex) is being hold. For details, please refer to [1].
>
> [1] https://lore.kernel.org/linux-can/CAMZ6Rq+sHpiw34ijPsmp7vbUpDtJwvVtdV7CvRZJsLixjAFfrg@xxxxxxxxxxxxxx/T/#t
>
> Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN
> devices")
> Signed-off-by: Vincent Mailhol <mailhol.vincent@xxxxxxxxxx>

Looks good to me, added to linux-can/testing.

regards,
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 |

Attachment: signature.asc
Description: PGP signature