diff options
author | Li Jinlin <lijinlin3@huawei.com> | 2022-09-16 15:42:23 +0800 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2022-10-20 11:02:18 -0400 |
commit | 47ab1faccb228e10869898c8a02b06f5a91a9174 (patch) | |
tree | a11174020e8f08bebe3a33b4257e5e1342912cdf | |
parent | 4e5f24ae426732cf6e3b1d68fa43c058a8d35156 (diff) | |
download | e2fsprogs-47ab1faccb228e10869898c8a02b06f5a91a9174.tar.gz |
tune2fs: exit directly when fs freed in ext2fs_run_ext3_journal
In ext2fs_run_ext3_journal(), fs will be freed and reallocated.
However, the reallocation by ext2fs_open() may fail in some cases ---
for example, when the device becomes offline. To avoid a segfault,
exit if fs is NULL.
[ Simplified the patch by by simply exiting if fs is NULL -TYT ]
Signed-off-by: Li Jinlin <lijinlin3@huawei.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
-rw-r--r-- | misc/tune2fs.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/misc/tune2fs.c b/misc/tune2fs.c index bed3d95b6..f566ed814 100644 --- a/misc/tune2fs.c +++ b/misc/tune2fs.c @@ -3106,6 +3106,8 @@ _("Warning: The journal is dirty. You may wish to replay the journal like:\n\n" com_err("tune2fs", retval, "while recovering journal.\n"); printf(_("Please run e2fsck -fy %s.\n"), argv[1]); + if (!fs) + exit(1); rc = 1; goto closefs; } |