git: da8749afdca8 - stable/13 - Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 07 Jun 2023 23:15:38 UTC
The branch stable/13 has been updated by mckusick:
URL: https://cgit.FreeBSD.org/src/commit/?id=da8749afdca81a435b76f8f54e7642e5ee232958
commit da8749afdca81a435b76f8f54e7642e5ee232958
Author: Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-05-28 22:23:16 +0000
Commit: Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2023-06-07 22:48:47 +0000
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Reported-by: Robert Morris
PR: 271383
Sponsored-by: The FreeBSD Foundation
(cherry picked from commit b796bfce48698449470b751de6b0d96ae7047202)
---
sbin/fsck_ffs/suj.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/sbin/fsck_ffs/suj.c b/sbin/fsck_ffs/suj.c
index cbb6e597dfee..5a09943406c8 100644
--- a/sbin/fsck_ffs/suj.c
+++ b/sbin/fsck_ffs/suj.c
@@ -734,7 +734,7 @@ indir_visit(ino_t ino, ufs_lbn_t lbn, ufs2_daddr_t blk, uint64_t *frags,
lbnadd *= NINDIR(fs);
bp = getdatablk(blk, fs->fs_bsize, BT_LEVEL1 + level);
if (bp->b_errs != 0)
- err_suj("indir_visit: UNRECOVERABLE I/O ERROR");
+ err_suj("indir_visit: UNRECOVERABLE I/O ERROR\n");
for (i = 0; i < NINDIR(fs); i++) {
if ((nblk = IBLK(bp, i)) == 0)
continue;
@@ -1916,6 +1916,9 @@ blk_build(struct jblkrec *blkrec)
blk = blknum(fs, blkrec->jb_blkno);
frag = fragnum(fs, blkrec->jb_blkno);
+ if (blkrec->jb_blkno < 0 || blk + fs->fs_frag - frag > fs->fs_size)
+ err_suj("Out-of-bounds journal block number %jd\n",
+ blkrec->jb_blkno);
sblk = blk_lookup(blk, 1);
/*
* Rewrite the record using oldfrags to indicate the offset into