1From 3d967e53033c85ad5d3af1a42efb2c4f7501c356 Mon Sep 17 00:00:00 2001 2From: lijinlin3@huawei.com 3Date: Fri, 16 Sep 2022 18:15:02 +0200 4Subject: [PATCH] tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal 5 6In ext2fs_run_ext3_journal(), fs will be free and reallocate. But 7reallocating by ext2fs_open() may fail in some cases, such as device 8being offline at the same time. In these cases, goto closefs will 9cause segfault, fix it by exiting directly. 10 11Signed-off-by: Li Jinlin <lijinlin3@huawei.com> 12--- 13 misc/tune2fs.c | 7 +++++-- 14 1 file changed, 5 insertions(+), 2 deletions(-) 15 16diff --git a/misc/tune2fs.c b/misc/tune2fs.c 17index 088f87e5..ee57dc7c 100644 18--- a/misc/tune2fs.c 19+++ b/misc/tune2fs.c 20@@ -3344,8 +3344,11 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" 21 com_err("tune2fs", retval, 22 "while recovering journal.\n"); 23 printf(_("Please run e2fsck -fy %s.\n"), argv[1]); 24- rc = 1; 25- goto closefs; 26+ if (fs) { 27+ rc = 1; 28+ goto closefs; 29+ } 30+ exit(1); 31 } 32 sb = fs->super; 33 } 34-- 352.23.0 36