Re: [PATCH] watchdog: s3c2410: Fix potential deadlock on &wdt->lock

From: Krzysztof Kozlowski
Date: Tue Jul 04 2023 - 03:54:15 EST


On 28/06/2023 18:47, Chengfeng Ye wrote:
> As &wdt->lock is acquired by hard irq s3c2410wdt_irq(),
> other acquisition of the same lock under process context should
> disable irq, otherwise deadlock could happen if the
> irq preempt the execution while the lock is held in process context
> on the same CPU.
>
> [Interrupt]: s3c2410wdt_irq
> -->/root/linux/drivers/watchdog/s3c2410_wdt.c:547
> -->/root/linux/drivers/watchdog/s3c2410_wdt.c:383
> -->spin_lock(&wdt->lock);

This interrupt is a threaded interrupt. Therefore the
s3c2410wdt_keepalive() will be called again from process thread. Are you
sure there is deadlock?

Anyway, please also strip unrelated paths and rather use function names,
not references to lines, because these might be not accurate.


Best regards,
Krzysztof