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

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®