dmu_recv_begin_check: dsl_dataset_rele() should be called on ds

We call dsl_dataset_hold() to initialize ds, and are supposed to call
dsl_dataset_rele() on ds when we are done. In two error paths, we call
dsl_dataset_rele_flags(). If ds is an encrypted dataset, this can drop
the key mapping for the dataset, which will cause run time issues. On
unencrypted datasets, this is a no-op.

Reported-by: Grok 4.6 Build Beta
Reviewed-by: Brian Behlendorf <[email protected]>
Reviewed-by: Alexander Motin <[email protected]>
Signed-off-by: Richard Yao <[email protected]>
Closes #18961
This commit is contained in:
Richard Yao authored and GitHub committed 2026-08-21 09:52:08 -07:00
1 parent 0d945dbcb3
commit acbcdd92cf
1 file changed
+2 -3
+2 -3
View File
@@ -850,8 +850,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
if (!redact_check(drba, origin)) {
dsl_dataset_rele_flags(origin, dsflags,
FTAG);
dsl_dataset_rele_flags(ds, dsflags,
FTAG);
dsl_dataset_rele(ds, FTAG);
return (SET_ERROR(EINVAL));
}
}
@@ -859,7 +858,7 @@ dmu_recv_begin_check(void *arg, dmu_tx_t *tx)
error = recv_check_large_blocks(ds, featureflags);
if (error != 0) {
dsl_dataset_rele_flags(origin, dsflags, FTAG);
dsl_dataset_rele_flags(ds, dsflags, FTAG);
dsl_dataset_rele(ds, FTAG);
return (error);
}