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
  https://github.com/illumos/illumos-gate/commit/beddaa9

Ported-by: Andriy Gapon <avg@FreeBSD.org>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #3551
This commit is contained in:
Andriy Gapon 2015-07-02 16:03:58 +03:00 committed by Brian Behlendorf
parent fec417097b
commit b6640117f0

View File

@ -2042,7 +2042,7 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
error = dsl_dataset_hold_obj(dp, obj, FTAG,
&snap);
if (error != 0)
return (error);
break;
if (snap->ds_dir != origin_head->ds_dir)
error = SET_ERROR(EINVAL);
if (error == 0) {
@ -2052,7 +2052,11 @@ dmu_recv_end_check(void *arg, dmu_tx_t *tx)
obj = dsl_dataset_phys(snap)->ds_prev_snap_obj;
dsl_dataset_rele(snap, FTAG);
if (error != 0)
return (error);
break;
}
if (error != 0) {
dsl_dataset_rele(origin_head, FTAG);
return (error);
}
}
error = dsl_dataset_clone_swap_check_impl(drc->drc_ds,