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 <lundman@lundman.net>
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
Closes #1109
This commit is contained in:
Brian Behlendorf 2012-11-27 14:02:49 -08:00
parent 30315d237b
commit f74a147c02
1 changed files with 1 additions and 1 deletions

View File

@ -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: