Skip to content

Commit faa1b9e

Browse files
committed
Fix 2 bugs in non-raw send with encryption
Bisecting identified the redacted send/receive as the source of the bug for issue #12014. Specifically the call to dsl_dataset_hold_obj(..&fromds) had been replaced by dsl_dataset_hold_obj_flags() which would pass a DECRYPT flag and create a key mapping. The problem here arises when trying to access the MASTER_NODE_OBJ that key mapping is used and the code panics. Fix this by restoring the call to dsl_dataset_hold_obj(). Later on in dmu_send_obj() the change dsl_dataset_rele(on to_ds) to dsl_dataset_rele_flags(), otherwise the created key mapping (on to_ds) earlier on is leaked, which result in panicking when exporting the sending pool or unloading the zfs module after a non-encrypted send from an encrypted filesystem. Signed-off-by: George Amanakis <[email protected]>
1 parent 5d71fa1 commit faa1b9e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

module/zfs/dmu_send.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2688,8 +2688,8 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
26882688
}
26892689

26902690
if (fromsnap != 0) {
2691-
err = dsl_dataset_hold_obj_flags(dspp.dp, fromsnap, dsflags,
2692-
FTAG, &fromds);
2691+
err = dsl_dataset_hold_obj(dspp.dp, fromsnap, FTAG, &fromds);
2692+
26932693
if (err != 0) {
26942694
dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG);
26952695
dsl_pool_rele(dspp.dp, FTAG);
@@ -2741,7 +2741,7 @@ dmu_send_obj(const char *pool, uint64_t tosnap, uint64_t fromsnap,
27412741
kmem_free(dspp.fromredactsnaps,
27422742
dspp.numfromredactsnaps * sizeof (uint64_t));
27432743

2744-
dsl_dataset_rele(dspp.to_ds, FTAG);
2744+
dsl_dataset_rele_flags(dspp.to_ds, dsflags, FTAG);
27452745
return (err);
27462746
}
27472747

0 commit comments

Comments
 (0)