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] [thread-next>] [day] [month] [year] [list]
Message-ID: <203ef118-30ca-0ce9-f73e-c5ee45f61369@kernel.org>
Date:   Sat, 1 Apr 2023 08:53:28 +0800
From:   Chao Yu <chao@...nel.org>
To:     Bo Ye <bo.ye@...iatek.com>, Jaegeuk Kim <jaegeuk@...nel.org>,
        Matthias Brugger <matthias.bgg@...il.com>,
        AngeloGioacchino Del Regno 
        <angelogioacchino.delregno@...labora.com>
Cc:     yongdong.zhang@...iatek.com, peng.zhou@...iatek.com,
        browse.zhang@...iatek.com, light.hsieh@...iatek.com,
        Qilin Tan <qilin.tan@...iatek.com>,
        linux-f2fs-devel@...ts.sourceforge.net,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        linux-mediatek@...ts.infradead.org
Subject: Re: [PATCH 1/2] f2fs: fix iostat lock protection

On 2023/3/31 17:26, Bo Ye wrote:
> From: Qilin Tan <qilin.tan@...iatek.com>
> 
> Made iostat lock irq safe to avoid potentinal deadlock.
> 
> Deadlock scenario:
> f2fs_attr_store
>    -> f2fs_sbi_store
>    -> _sbi_store
>    -> spin_lock(sbi->iostat_lock)
>      <interrupt request>
>      -> scsi_end_request
>      -> bio_endio
>      -> f2fs_dio_read_end_io
>      -> f2fs_update_iostat
>      -> spin_lock_irqsave(sbi->iostat_lock)  ===> Dead lock here
> 

Fixes: 61803e984307 ("f2fs: fix iostat related lock protection")
Fixes: a1e09b03e6f5 ("f2fs: use iomap for direct I/O")

> Signed-off-by: Qilin Tan <qilin.tan@...iatek.com>

Reviewed-by: Chao Yu <chao@...nel.org>

Thanks,

> ---
>   fs/f2fs/sysfs.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/f2fs/sysfs.c b/fs/f2fs/sysfs.c
> index 0b19163c90d4..fd238a68017e 100644
> --- a/fs/f2fs/sysfs.c
> +++ b/fs/f2fs/sysfs.c
> @@ -575,9 +575,9 @@ static ssize_t __sbi_store(struct f2fs_attr *a,
>   	if (!strcmp(a->attr.name, "iostat_period_ms")) {
>   		if (t < MIN_IOSTAT_PERIOD_MS || t > MAX_IOSTAT_PERIOD_MS)
>   			return -EINVAL;
> -		spin_lock(&sbi->iostat_lock);
> +		spin_lock_irq(&sbi->iostat_lock);
>   		sbi->iostat_period_ms = (unsigned int)t;
> -		spin_unlock(&sbi->iostat_lock);
> +		spin_unlock_irq(&sbi->iostat_lock);
>   		return count;
>   	}
>   #endif

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ