From: Bart Van Assche <bvanassche@acm.org>
To: Marc Kleine-Budde <mkl@pengutronix.de>,
Vincent Mailhol <mailhol@kernel.org>
Cc: Wolfgang Grandegger <wg@grandegger.com>,
Kurt Van Dijck <dev.kurt@vandijck-laurijssen.be>,
linux-can@vger.kernel.org, linux-kernel@vger.kernel.org,
Bart Van Assche <bvanassche@acm.org>
Subject: [PATCH] can: softing: Fix locking in softing_card_shutdown()
Date: Mon, 26 Oct 2026 12:47:07 -0700 [thread overview]
Message-ID: <192450922df0eb9ce0cebccf381363680db65604.1793044027.git.bvanassche@acm.org> (raw)
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;
next reply other threads:[~2026-10-26 19:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-26 19:47 Bart Van Assche [this message]
2026-10-26 20:14 ` Marc Kleine-Budde
2026-10-26 20:25 ` Bart Van Assche
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=192450922df0eb9ce0cebccf381363680db65604.1793044027.git.bvanassche@acm.org \
--to=bvanassche@acm.org \
--cc=dev.kurt@vandijck-laurijssen.be \
--cc=linux-can@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mailhol@kernel.org \
--cc=mkl@pengutronix.de \
--cc=wg@grandegger.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®