aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirk McKusick <mckusick@FreeBSD.org>2021-05-21 20:41:40 +0000
committerKirk McKusick <mckusick@FreeBSD.org>2021-05-21 20:42:37 +0000
commitf190f9193bc10a8193c87e0a02fa91400e4eb159 (patch)
treeac9afdd7baddf3c080a7590a1950ff3c1c20373d
parentfdbc86cf79784f56fab8115f2d565962e1111b2e (diff)
downloadsrc-f190f9193bc10a8193c87e0a02fa91400e4eb159.tar.gz
src-f190f9193bc10a8193c87e0a02fa91400e4eb159.zip
Fix fsck_ufs segfaults with gjournal (SU+J)
The segfault was being hit in ckfini() (sbin/fsck_ffs/fsutil.c) while attempting to traverse the buffer cache to flush dirty buffers. The tail queue used for the buffer cache was not initialized before dropping into gjournal_check(). Move the buffer initialization earlier so that it has been done before calling gjournal_check(). Reported by: crypt47, nvass Fix by: Robert Wing Tested by: Robert Wing PR: 255030 PR: 255979 MFC after: 3 days Sponsored by: Netflix
-rw-r--r--sbin/fsck_ffs/main.c1
-rw-r--r--sbin/fsck_ffs/setup.c1
2 files changed, 1 insertions, 1 deletions
diff --git a/sbin/fsck_ffs/main.c b/sbin/fsck_ffs/main.c
index 401ee10f9be3..642e321fdd35 100644
--- a/sbin/fsck_ffs/main.c
+++ b/sbin/fsck_ffs/main.c
@@ -272,6 +272,7 @@ checkfilesys(char *filesys)
* exit status will cause a foreground check to be run.
*/
sblock_init();
+ bufinit();
if (bkgrdcheck) {
if ((fsreadfd = open(filesys, O_RDONLY)) < 0 || readsb(0) == 0)
exit(3); /* Cannot read superblock */
diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 0ae7f1bbb28f..d69beff879e9 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -298,7 +298,6 @@ setup(char *dev)
(uintmax_t)numdirs * sizeof(struct inoinfo *));
goto badsb;
}
- bufinit();
if (sblock.fs_flags & FS_DOSOFTDEP)
usedsoftdep = 1;
else