git: 0bd8274c8529 - stable/14 - Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Sat, 28 Oct 2023 21:11:11 UTC
The branch stable/14 has been updated by mckusick:

URL: https://cgit.FreeBSD.org/src/commit/?id=0bd8274c8529145fb1cba77b538291545cd34c39

commit 0bd8274c8529145fb1cba77b538291545cd34c39
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-10-20 22:14:46 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2023-10-28 21:09:36 +0000

    Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
    
    Reported-by:  Andreas Bock
    PR:           274404
    (cherry picked from commit 1e39a0886e0999520a7e7136e3f7d09e9cd9a5f2)
---
 sbin/fsck_ffs/setup.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sbin/fsck_ffs/setup.c b/sbin/fsck_ffs/setup.c
index 49e89f9221b0..d1d09d07b43a 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -299,6 +299,8 @@ checksnapinfo(struct inode *snapip)
 	size = fragroundup(fs,
 	    DIP(snapip->i_dp, di_size) - lblktosize(fs, lbn));
 	bp = getdatablk(idesc.id_parent, size, BT_DATA);
+	if (bp->b_errs != 0)
+		return (0);
 	snapblklist = (daddr_t *)bp->b_un.b_buf;
 	/*
 	 * snapblklist[0] is the size of the list