mirror of
https://github.com/opnsense/src.git
synced 2026-05-28 04:12:45 -04:00
Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
Check for valid block numbers while loading journal entries that contain block numbers. If an invalid block number is found, fall back to full fsck. Reported-by: Robert Morris PR: 271383 MFC-after: 1 week Sponsored-by: The FreeBSD Foundation
This commit is contained in:
parent
9ed4ec4ae3
commit
b796bfce48
1 changed files with 4 additions and 1 deletions
|
|
@ -736,7 +736,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;
|
||||
|
|
@ -1918,6 +1918,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
|
||||
|
|
|
|||
Loading…
Reference in a new issue