git: 1e39a0886e09 - main - Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.

From: Kirk McKusick <mckusick_at_FreeBSD.org>
Date: Fri, 20 Oct 2023 22:16:02 UTC
The branch main has been updated by mckusick:

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

commit 1e39a0886e0999520a7e7136e3f7d09e9cd9a5f2
Author:     Kirk McKusick <mckusick@FreeBSD.org>
AuthorDate: 2023-10-20 22:14:46 +0000
Commit:     Kirk McKusick <mckusick@FreeBSD.org>
CommitDate: 2023-10-20 22:15:40 +0000

    Fix a bug in fsck_ffs(8) triggered by corrupted filesystems.
    
    Add missing check for failed block read when checking information about
    a snapshot file.
    
    Reported-by:  Andreas Bock
    PR:           274404
    MFC-after:    1 week
---
 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