]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.10-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Dec 2020 13:39:55 +0000 (14:39 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Dec 2020 13:39:55 +0000 (14:39 +0100)
added patches:
f2fs-fix-to-seek-incorrect-data-offset-in-inline-data-file.patch

queue-5.10/f2fs-fix-to-seek-incorrect-data-offset-in-inline-data-file.patch [new file with mode: 0644]
queue-5.10/series

diff --git a/queue-5.10/f2fs-fix-to-seek-incorrect-data-offset-in-inline-data-file.patch b/queue-5.10/f2fs-fix-to-seek-incorrect-data-offset-in-inline-data-file.patch
new file mode 100644 (file)
index 0000000..1e5bc9a
--- /dev/null
@@ -0,0 +1,66 @@
+From 7a6e59d719ef0ec9b3d765cba3ba98ee585cbde3 Mon Sep 17 00:00:00 2001
+From: Chao Yu <chao@kernel.org>
+Date: Mon, 2 Nov 2020 17:36:58 +0800
+Subject: f2fs: fix to seek incorrect data offset in inline data file
+
+From: Chao Yu <yuchao0@huawei.com>
+
+commit 7a6e59d719ef0ec9b3d765cba3ba98ee585cbde3 upstream.
+
+As kitestramuort reported:
+
+F2FS-fs (nvme0n1p4): access invalid blkaddr:1598541474
+[   25.725898] ------------[ cut here ]------------
+[   25.725903] WARNING: CPU: 6 PID: 2018 at f2fs_is_valid_blkaddr+0x23a/0x250
+[   25.725923] Call Trace:
+[   25.725927]  ? f2fs_llseek+0x204/0x620
+[   25.725929]  ? ovl_copy_up_data+0x14f/0x200
+[   25.725931]  ? ovl_copy_up_inode+0x174/0x1e0
+[   25.725933]  ? ovl_copy_up_one+0xa22/0xdf0
+[   25.725936]  ? ovl_copy_up_flags+0xa6/0xf0
+[   25.725938]  ? ovl_aio_cleanup_handler+0xd0/0xd0
+[   25.725939]  ? ovl_maybe_copy_up+0x86/0xa0
+[   25.725941]  ? ovl_open+0x22/0x80
+[   25.725943]  ? do_dentry_open+0x136/0x350
+[   25.725945]  ? path_openat+0xb7e/0xf40
+[   25.725947]  ? __check_sticky+0x40/0x40
+[   25.725948]  ? do_filp_open+0x70/0x100
+[   25.725950]  ? __check_sticky+0x40/0x40
+[   25.725951]  ? __check_sticky+0x40/0x40
+[   25.725953]  ? __x64_sys_openat+0x1db/0x2c0
+[   25.725955]  ? do_syscall_64+0x2d/0x40
+[   25.725957]  ? entry_SYSCALL_64_after_hwframe+0x44/0xa9
+
+llseek() reports invalid block address access, the root cause is if
+file has inline data, f2fs_seek_block() will access inline data regard
+as block address index in inode block, which should be wrong, fix it.
+
+Reported-by: kitestramuort <kitestramuort@autistici.org>
+Signed-off-by: Chao Yu <yuchao0@huawei.com>
+Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/f2fs/file.c |   11 ++++++++---
+ 1 file changed, 8 insertions(+), 3 deletions(-)
+
+--- a/fs/f2fs/file.c
++++ b/fs/f2fs/file.c
+@@ -412,9 +412,14 @@ static loff_t f2fs_seek_block(struct fil
+               goto fail;
+       /* handle inline data case */
+-      if (f2fs_has_inline_data(inode) && whence == SEEK_HOLE) {
+-              data_ofs = isize;
+-              goto found;
++      if (f2fs_has_inline_data(inode)) {
++              if (whence == SEEK_HOLE) {
++                      data_ofs = isize;
++                      goto found;
++              } else if (whence == SEEK_DATA) {
++                      data_ofs = offset;
++                      goto found;
++              }
+       }
+       pgofs = (pgoff_t)(offset >> PAGE_SHIFT);
index 5c6a8c3d92c90d2c2a991f0dc623bf2cd4d97592..7a83b53dc8354c4f9b2e775214e1cbbcf7230835 100644 (file)
@@ -21,3 +21,4 @@ coresight-etm4x-fix-accesses-to-trcvmidctlr1.patch
 coresight-etm4x-fix-accesses-to-trccidctlr1.patch
 coresight-etm4x-fix-accesses-to-trcprocselr.patch
 coresight-etm4x-handle-trcvipcssctlr-accesses.patch
+f2fs-fix-to-seek-incorrect-data-offset-in-inline-data-file.patch