From 277884ab428f33b3185a4dc0b2175239c9504c57 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Wed, 21 Oct 2020 18:05:18 +0000 Subject: [PATCH] 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 Reviewed-by: Matt Macy Signed-off-by: Ryan Moeller Closes #11117 --- module/os/freebsd/zfs/zvol_os.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/module/os/freebsd/zfs/zvol_os.c b/module/os/freebsd/zfs/zvol_os.c index bae39c6d5..8431b4e60 100644 --- a/module/os/freebsd/zfs/zvol_os.c +++ b/module/os/freebsd/zfs/zvol_os.c @@ -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); }