From: Greg Kroah-Hartman Date: Fri, 9 Jun 2023 11:11:59 +0000 (+0200) Subject: 5.10-stable patches X-Git-Tag: v4.14.318~83 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=81c778752b151e1f763f1ab43d418bca0b6985de;p=thirdparty%2Fkernel%2Fstable-queue.git 5.10-stable patches added patches: f2fs-fix-iostat-lock-protection.patch --- diff --git a/queue-5.10/f2fs-fix-iostat-lock-protection.patch b/queue-5.10/f2fs-fix-iostat-lock-protection.patch new file mode 100644 index 00000000000..6c06a244d71 --- /dev/null +++ b/queue-5.10/f2fs-fix-iostat-lock-protection.patch @@ -0,0 +1,48 @@ +From 144f1cd40bf91fb3ac1d41806470756ce774f389 Mon Sep 17 00:00:00 2001 +From: Qilin Tan +Date: Fri, 31 Mar 2023 17:26:56 +0800 +Subject: f2fs: fix iostat lock protection + +From: Qilin Tan + +commit 144f1cd40bf91fb3ac1d41806470756ce774f389 upstream. + +Made iostat lock irq safe to avoid potentinal deadlock. + +Deadlock scenario: +f2fs_attr_store + -> f2fs_sbi_store + -> _sbi_store + -> spin_lock(sbi->iostat_lock) + + -> 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 +Reviewed-by: Chao Yu +Signed-off-by: Jaegeuk Kim +Cc: Daniel Rosenberg +Signed-off-by: Greg Kroah-Hartman +--- + fs/f2fs/sysfs.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/f2fs/sysfs.c ++++ b/fs/f2fs/sysfs.c +@@ -403,9 +403,9 @@ out: + 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; + } + diff --git a/queue-5.10/series b/queue-5.10/series index a85d6ad1cee..5ff85dc71d2 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -3,3 +3,4 @@ gcc-plugins-reorganize-gimple-includes-for-gcc-13.patch sfc-gcc13-synchronize-ef100_enqueue_skb-s-return-type.patch remove-the-sx8-block-driver.patch bonding-gcc13-synchronize-bond_-a-t-lb_xmit-types.patch +f2fs-fix-iostat-lock-protection.patch