From f74a147c022f79916e8525c2c16b1603f91202aa Mon Sep 17 00:00:00 2001 From: Brian Behlendorf Date: Tue, 27 Nov 2012 14:02:49 -0800 Subject: [PATCH] Fix NULL deref when zvol_alloc() fails If zvol_alloc() fails zv will be set to NULL and dereferenced in out_dmu_objset_disown. To avoid this entirely the zv->objset line is moved up in to the success block. Original-patch-by: Jorgen Lundman Signed-off-by: Brian Behlendorf Closes #1109 --- module/zfs/zvol.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/zfs/zvol.c b/module/zfs/zvol.c index c3bd25c3b..5d4802560 100644 --- a/module/zfs/zvol.c +++ b/module/zfs/zvol.c @@ -1306,9 +1306,9 @@ __zvol_create_minor(const char *name) else zil_replay(os, zv, zvol_replay_vector); + zv->zv_objset = NULL; out_dmu_objset_disown: dmu_objset_disown(os, zvol_tag); - zv->zv_objset = NULL; out_doi: kmem_free(doi, sizeof(dmu_object_info_t)); out: -- 2.40.0