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
| ||
|
Message-Id: <20231222032901.3861649-2-yangyongpeng1@oppo.com> Date: Fri, 22 Dec 2023 11:29:01 +0800 From: Yongpeng Yang <yangyongpeng1@...o.com> To: Jaegeuk Kim <jaegeuk@...nel.org>, Chao Yu <chao@...nel.org> Cc: linux-f2fs-devel@...ts.sourceforge.net, linux-kernel@...r.kernel.org, Yongpeng Yang <yangyongpeng1@...o.com> Subject: [PATCH 2/2] f2fs: Add error handling for negative returns from do_garbage_collect The function do_garbage_collect can return a value less than 0 due to f2fs_cp_error being true or page allocation failure, as a result of calling f2fs_get_sum_page. However, f2fs_gc does not account for such cases, which could potentially lead to an abnormal total_freed and thus cause subsequent code to behave unexpectedly. Given that an f2fs_cp_error is irrecoverable, and considering that do_garbage_collect already retries page allocation errors through its call to f2fs_get_sum_page->f2fs_get_meta_page_retry, any error reported by do_garbage_collect should immediately terminate the current GC. Signed-off-by: Yongpeng Yang <yangyongpeng1@...o.com> --- fs/f2fs/gc.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fs/f2fs/gc.c b/fs/f2fs/gc.c index 405a6077bd83..771d56b0bfb8 100644 --- a/fs/f2fs/gc.c +++ b/fs/f2fs/gc.c @@ -1865,6 +1865,9 @@ int f2fs_gc(struct f2fs_sb_info *sbi, struct f2fs_gc_control *gc_control) seg_freed = do_garbage_collect(sbi, segno, &gc_list, gc_type, gc_control->should_migrate_blocks); + if (seg_freed < 0) + goto stop; + total_freed += seg_freed; if (seg_freed == f2fs_usable_segs_in_sec(sbi, segno)) { -- 2.40.1
Powered by blists - more mailing lists