Fix NULL pointer dereference in dbuf_prefetch_indirect_done()
When ZFS is built with assertions, a prefetch is done on a redacted blkptr and `dpa->dpa_dnode` is NULL, we will have a NULL pointer dereference in `dbuf_prefetch_indirect_done()`. Both Coverity and Clang's Static Analyzer caught this. Reported-by: Coverity (CID 1524671) Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Ryan Moeller <ryan@iXsystems.com> Signed-off-by: Richard Yao <richard.yao@alumni.stonybrook.edu> Closes #14210
This commit is contained in:
parent
0e3abd2994
commit
e48aaef89f
|
@ -3300,10 +3300,10 @@ dbuf_prefetch_indirect_done(zio_t *zio, const zbookmark_phys_t *zb,
|
||||||
blkptr_t *bp = ((blkptr_t *)abuf->b_data) +
|
blkptr_t *bp = ((blkptr_t *)abuf->b_data) +
|
||||||
P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs);
|
P2PHASE(nextblkid, 1ULL << dpa->dpa_epbs);
|
||||||
|
|
||||||
ASSERT(!BP_IS_REDACTED(bp) ||
|
ASSERT(!BP_IS_REDACTED(bp) || (dpa->dpa_dnode &&
|
||||||
dsl_dataset_feature_is_active(
|
dsl_dataset_feature_is_active(
|
||||||
dpa->dpa_dnode->dn_objset->os_dsl_dataset,
|
dpa->dpa_dnode->dn_objset->os_dsl_dataset,
|
||||||
SPA_FEATURE_REDACTED_DATASETS));
|
SPA_FEATURE_REDACTED_DATASETS)));
|
||||||
if (BP_IS_HOLE(bp) || BP_IS_REDACTED(bp)) {
|
if (BP_IS_HOLE(bp) || BP_IS_REDACTED(bp)) {
|
||||||
dbuf_prefetch_fini(dpa, B_TRUE);
|
dbuf_prefetch_fini(dpa, B_TRUE);
|
||||||
} else if (dpa->dpa_curlevel == dpa->dpa_zb.zb_level) {
|
} else if (dpa->dpa_curlevel == dpa->dpa_zb.zb_level) {
|
||||||
|
|
Loading…
Reference in New Issue