[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250508051520.4169795-2-hch@lst.de>
Date: Thu, 8 May 2025 07:14:27 +0200
From: Christoph Hellwig <hch@....de>
To: Jaegeuk Kim <jaegeuk@...nel.org>,
Chao Yu <chao@...nel.org>
Cc: linux-f2fs-devel@...ts.sourceforge.net,
linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Subject: [PATCH 1/6] f2fs: fix to return correct error number in f2fs_sync_node_pages()
From: Chao Yu <chao@...nel.org>
If __write_node_folio() failed, it will return AOP_WRITEPAGE_ACTIVATE,
the incorrect return value may be passed to userspace in below path,
fix it.
- sync_filesystem
- sync_fs
- f2fs_issue_checkpoint
- block_operations
- f2fs_sync_node_pages
- __write_node_folio
: return AOP_WRITEPAGE_ACTIVATE
Cc: stable@...r.kernel.org
Reported-by: Christoph Hellwig <hch@....de>
Signed-off-by: Chao Yu <chao@...nel.org>
---
fs/f2fs/node.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c
index ec74eb9982a5..69308523c34e 100644
--- a/fs/f2fs/node.c
+++ b/fs/f2fs/node.c
@@ -2092,10 +2092,14 @@ int f2fs_sync_node_pages(struct f2fs_sb_info *sbi,
ret = __write_node_folio(folio, false, &submitted,
wbc, do_balance, io_type, NULL);
- if (ret)
+ if (ret) {
folio_unlock(folio);
- else if (submitted)
+ folio_batch_release(&fbatch);
+ ret = -EIO;
+ goto out;
+ } else if (submitted) {
nwritten++;
+ }
if (--wbc->nr_to_write == 0)
break;
--
2.47.2
Powered by blists - more mailing lists