mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] can: softing: Fix locking in softing_card_shutdown()
@ 2026-10-26 19:47 Bart Van Assche
  2026-10-26 20:14 ` Marc Kleine-Budde
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Van Assche @ 2026-10-26 19:47 UTC (permalink / raw)
  To: Marc Kleine-Budde, Vincent Mailhol
  Cc: Wolfgang Grandegger, Kurt Van Dijck, linux-can, linux-kernel,
	Bart Van Assche

If mutex_lock_interruptible() fails, softing_card_shutdown() goes on
without holding card->fw.lock and later unlocks that mutex anyway.
Shutting down cannot fail, so use mutex_lock() instead. This makes
sure the firmware state is always changed with fw.lock held and that
only a held mutex is unlocked.

Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
---
 drivers/net/can/softing/softing_main.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c
index 519ab3097f86..d3dfad4f5321 100644
--- a/drivers/net/can/softing/softing_main.c
+++ b/drivers/net/can/softing/softing_main.c
@@ -448,9 +448,7 @@ static void softing_card_shutdown(struct softing *card)
 {
 	int fw_up = 0;
 
-	if (mutex_lock_interruptible(&card->fw.lock)) {
-		/* return -ERESTARTSYS */;
-	}
+	mutex_lock(&card->fw.lock);
 	fw_up = card->fw.up;
 	card->fw.up = 0;
 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: softing: Fix locking in softing_card_shutdown()
  2026-10-26 19:47 [PATCH] can: softing: Fix locking in softing_card_shutdown() Bart Van Assche
@ 2026-10-26 20:14 ` Marc Kleine-Budde
  2026-10-26 20:25   ` Bart Van Assche
  0 siblings, 1 reply; 3+ messages in thread
From: Marc Kleine-Budde @ 2026-10-26 20:14 UTC (permalink / raw)
  To: Bart Van Assche
  Cc: Vincent Mailhol, Wolfgang Grandegger, Kurt Van Dijck, linux-can,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 898 bytes --]

Hello Bart,

thanks for you contribution.

On 26.10.2026 12:47:07, Bart Van Assche wrote:
> If mutex_lock_interruptible() fails, softing_card_shutdown() goes on
> without holding card->fw.lock and later unlocks that mutex anyway.
> Shutting down cannot fail, so use mutex_lock() instead. This makes
> sure the firmware state is always changed with fw.lock held and that
> only a held mutex is unlocked.
>
> Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
> Signed-off-by: Bart Van Assche <bvanassche@acm.org>

Are you actively using this driver? It's scheduled for removal in the
v7.15.

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 #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] can: softing: Fix locking in softing_card_shutdown()
  2026-10-26 20:14 ` Marc Kleine-Budde
@ 2026-10-26 20:25   ` Bart Van Assche
  0 siblings, 0 replies; 3+ messages in thread
From: Bart Van Assche @ 2026-10-26 20:25 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: Vincent Mailhol, Wolfgang Grandegger, Kurt Van Dijck, linux-can,
	linux-kernel

On 10/26/26 1:14 PM, Marc Kleine-Budde wrote:
> Are you actively using this driver? It's scheduled for removal in the
> v7.15.
I'm not using the driver. I'm working on fixing all locking bugs across
the entire kernel tree. Removing this driver will also make the locking
bug disappear :-)

Thanks,

Bart.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-10-26 20:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-26 19:47 [PATCH] can: softing: Fix locking in softing_card_shutdown() Bart Van Assche
2026-10-26 20:14 ` Marc Kleine-Budde
2026-10-26 20:25   ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®