1From 47ab1faccb228e10869898c8a02b06f5a91a9174 Mon Sep 17 00:00:00 2001 2From: Li Jinlin <lijinlin3@huawei.com> 3Date: Fri, 16 Sep 2022 15:42:23 +0800 4Subject: tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal 5 6In ext2fs_run_ext3_journal(), fs will be freed and reallocated. 7However, the reallocation by ext2fs_open() may fail in some cases --- 8for example, when the device becomes offline. To avoid a segfault, 9exit if fs is NULL. 10 11[ Simplified the patch by by simply exiting if fs is NULL -TYT ] 12 13Signed-off-by: Li Jinlin <lijinlin3@huawei.com> 14Signed-off-by: Theodore Ts'o <tytso@mit.edu> 15--- 16 misc/tune2fs.c | 2 ++ 17 1 file changed, 2 insertions(+) 18 19diff --git a/misc/tune2fs.c b/misc/tune2fs.c 20index bed3d95b..f566ed81 100644 21--- a/misc/tune2fs.c 22+++ b/misc/tune2fs.c 23@@ -3106,6 +3106,8 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" 24 com_err("tune2fs", retval, 25 "while recovering journal.\n"); 26 printf(_("Please run e2fsck -fy %s.\n"), argv[1]); 27+ if (!fs) 28+ exit(1); 29 rc = 1; 30 goto closefs; 31 } 32-- 33cgit 34 35