Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a crash when attempting to read a block pointer with no valid DVAs #17078

Merged
merged 1 commit into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ typedef struct blkptr {
(u_longlong_t)DVA_GET_ASIZE(dva), \
ws); \
} \
ASSERT3S(copies, >, 0); \
if (BP_IS_ENCRYPTED(bp)) { \
len += func(buf + len, size - len, \
"salt=%llx iv=%llx:%llx%c", \
Expand All @@ -679,10 +678,6 @@ typedef struct blkptr {
(u_longlong_t)BP_GET_IV2(bp), \
ws); \
} \
if (BP_IS_GANG(bp) && \
DVA_GET_ASIZE(&bp->blk_dva[2]) <= \
DVA_GET_ASIZE(&bp->blk_dva[1]) / 2) \
copies--; \
len += func(buf + len, size - len, \
"[L%llu %s] %s %s %s %s %s %s %s%c" \
"size=%llxL/%llxP birth=%lluL/%lluP fill=%llu%c" \
Expand Down
10 changes: 10 additions & 0 deletions module/zfs/zio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1212,6 +1212,16 @@ zfs_blkptr_verify(spa_t *spa, const blkptr_t *bp,
bp, (longlong_t)BPE_GET_PSIZE(bp));
}
return (errors ? ECKSUM : 0);
} else if (BP_IS_HOLE(bp)) {
/*
* Holes are allowed (expected, even) to have no DVAs, no
* checksum, and no psize.
*/
return (errors ? ECKSUM : 0);
} else if (unlikely(!DVA_IS_VALID(&bp->blk_dva[0]))) {
/* Non-hole, non-embedded BPs _must_ have at least one DVA */
errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
"blkptr at %px has no valid DVAs", bp);
}
if (unlikely(BP_GET_CHECKSUM(bp) >= ZIO_CHECKSUM_FUNCTIONS)) {
errors += zfs_blkptr_verify_log(spa, bp, blk_verify,
Expand Down
Loading