diff options
author | Chao Yu <chao@kernel.org> | 2025-05-08 07:14:27 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-06-27 11:13:04 +0100 |
commit | d0e68a63f03883fd6ae75de560a7791c50318026 (patch) | |
tree | 99f001e01493410154edba24e431556e47582c87 | |
parent | 3e5ac62a56a24f4d88ce8ffd7bc452428b235868 (diff) |
f2fs: fix to return correct error number in f2fs_sync_node_pages()
commit 43ba56a043b14426ca9ecac875ab357e32cb595e upstream.
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@vger.kernel.org
Reported-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Chao Yu <chao@kernel.org>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | fs/f2fs/node.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/f2fs/node.c b/fs/f2fs/node.c index 5f15c224bf78..f476c2e7b096 100644 --- a/fs/f2fs/node.c +++ b/fs/f2fs/node.c @@ -2107,10 +2107,14 @@ write_node: ret = __write_node_page(&folio->page, 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; |