Re: [PATCH] can: softing: lock card->fw.lock unconditionally in softing_card_shutdown()

From: Marc Kleine-Budde

Date: Thu Nov 19 2026 - 12:27:32 EST


On 19.11.2026 09:07:22, Ian Rogers wrote:
> softing_card_shutdown() calls mutex_lock_interruptible(&card->fw.lock)
> with an empty if-body ('{ /* return -ERESTARTSYS */; }'). Because
> softing_pdev_remove() invokes softing_card_shutdown() before
> unregistering netdevs or removing sysfs attributes, a pending signal
> while card->fw.lock is contended causes mutex_lock_interruptible() to
> return -EINTR without acquiring the lock. Execution then proceeds unlocked
> through IRQ and DPRAM teardown and calls mutex_unlock(&card->fw.lock) on a
> mutex not owned by the current task.
>
> Use mutex_lock(&card->fw.lock) in softing_card_shutdown().
>
> Found via an x86_64 LLVM=1 (Clang 21.1.8) allyesconfig audit with
> -Wextra-semi-stmt enabled; fix and changelog drafted with an AI coding
> assistant. Build-tested under LLVM=1 W=1 (-Werror) and -Wextra-semi-stmt;
> not tested on Softing CAN hardware.
>
> Fixes: 03fd3cf5a179 ("can: add driver for Softing card")
> Fixes: 47fa0336c1b7 ("can: softing: softing_card_shutdown(): add braces around empty body in an 'if' statement")
> Signed-off-by: Ian Rogers <irogers@xxxxxxxxxx>

The driver is being removed in net-next.

https://lore.kernel.org/all/20260815103428.117201-1-socketcan@xxxxxxxxxxxx/

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: signature.asc
Description: PGP signature