git: b08c5c8acf1e - stable/13 - Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

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

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

commit b08c5c8acf1e85bd719cc1f65a304948ae39bc4f
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:14:32 +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 d33311c79250..4584456d8a64 100644
--- a/sbin/fsck_ffs/setup.c
+++ b/sbin/fsck_ffs/setup.c
@@ -318,6 +318,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