diff options
author | Vincent Mailhol <mailhol.vincent@wanadoo.fr> | 2022-02-15 08:48:14 +0900 |
---|---|---|
committer | Marc Kleine-Budde <mkl@pengutronix.de> | 2022-02-25 09:14:34 +0100 |
commit | 035b0fcf02707d3c9c2890dc1484b11aa5335eb1 (patch) | |
tree | 0bb9fc91d54ed5d977dd4f62b19488550110aaa1 /drivers/net/can/rcar | |
parent | f4896248e9025ff744b4147e6758274a1cb8cbae (diff) | |
download | linux-035b0fcf02707d3c9c2890dc1484b11aa5335eb1.tar.bz2 |
can: gs_usb: change active_channels's type from atomic_t to u8
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@mail.gmail.com/T/#t
Fixes: d08e973a77d1 ("can: gs_usb: Added support for the GS_USB CAN devices")
Link: https://lore.kernel.org/all/20220214234814.1321599-1-mailhol.vincent@wanadoo.fr
Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Diffstat (limited to 'drivers/net/can/rcar')
0 files changed, 0 insertions, 0 deletions