Skip to content

Commit b664011

Browse files
avg-Ibehlendorf
authored andcommitted
Illumos 5870 - dmu_recv_end_check() leaks origin_head hold if error happens in drc_force branch
5870 dmu_recv_end_check() leaks origin_head hold if error happens in drc_force branch Reviewed by: Matthew Ahrens <mahrens@delphix.com> Reviewed by: Andrew Stormont <andyjstormont@gmail.com> Approved by: Dan McDonald <danmcd@omniti.com> References: https://www.illumos.org/issues/5870 illumos/illumos-gate@beddaa9 Ported-by: Andriy Gapon <avg@FreeBSD.org> Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov> Closes #3551
1 parent fec4170 commit b664011

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

module/zfs/dmu_send.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2042,7 +2042,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
20422042
error = dsl_dataset_hold_obj(dp, obj, FTAG,
20432043
&snap);
20442044
if (error != 0)
2045-
return (error);
2045+
break;
20462046
if (snap->ds_dir != origin_head->ds_dir)
20472047
error = SET_ERROR(EINVAL);
20482048
if (error == 0) {
@@ -2052,7 +2052,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
20522052
obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
20532053
dsl_dataset_rele(snap, FTAG);
20542054
if (error != 0)
2055-
return (error);
2055+
break;
2056+
}
2057+
if (error != 0) {
2058+
dsl_dataset_rele(origin_head, FTAG);
2059+
return (error);
20562060
}
20572061
}
20582062
error = dsl_dataset_clone_swap_check_impl(drc->drc_ds,

0 commit comments

Comments
 (0)