zvol_os: Don't leak doi in cdev error path

Make sure to free doi in zvol_create_minor impl when make_dev_s fails.

Reviewed-by: Alexander Motin <mav@FreeBSD.org>
Reviewed-by: Matt Macy <mmacy@FreeBSD.org>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #11117
This commit is contained in:
Ryan Moeller 2020-10-21 18:05:18 +00:00 committed by Brian Behlendorf
parent c2c643256c
commit 0c270bb6c4

View File

@ -1328,7 +1328,7 @@ zvol_create_minor_impl(const char *name)
mutex_destroy(&zv->zv_state_lock);
kmem_free(zv, sizeof (*zv));
dmu_objset_disown(os, B_TRUE, FTAG);
goto out_giant;
goto out_doi;
}
dev->si_iosize_max = MAXPHYS;
zsd->zsd_cdev = dev;
@ -1372,7 +1372,6 @@ out_doi:
rw_exit(&zvol_state_lock);
ZFS_LOG(1, "ZVOL %s created.", name);
}
out_giant:
PICKUP_GIANT();
return (error);
}