lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu,  9 Jun 2022 14:42:53 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Duoming Zhou <duoming@....edu.cn>, linux-mtd@...ts.infradead.org
Cc:     Miquel Raynal <miquel.raynal@...tlin.com>, richard@....at,
        vigneshr@...com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: Fix deadlock caused by cancel_work_sync in sm_release

On Tue, 2022-05-24 at 04:48:41 UTC, Duoming Zhou wrote:
> There is a deadlock between sm_release and sm_cache_flush_work
> which is a work item. The cancel_work_sync in sm_release will
> not return until sm_cache_flush_work is finished. If we hold
> mutex_lock and use cancel_work_sync to wait the work item to
> finish, the work item also requires mutex_lock. As a result,
> the sm_release will be blocked forever. The race condition is
> shown below:
> 
>     (Thread 1)             |   (Thread 2)
> sm_release                 |
>   mutex_lock(&ftl->mutex)  | sm_cache_flush_work
>                            |   mutex_lock(&ftl->mutex)
>   cancel_work_sync         |   ...
> 
> This patch moves del_timer_sync and cancel_work_sync out of
> mutex_lock in order to mitigate deadlock.
> 
> Fixes: 7d17c02a01a1 ("mtd: Add new SmartMedia/xD FTL")
> Signed-off-by: Duoming Zhou <duoming@....edu.cn>

Applied to https://git.kernel.org/pub/scm/linux/kernel/git/mtd/linux.git mtd/next, thanks.

Miquel

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ