Skip to content

Commit 3f7d041

Browse files
loli10Kbehlendorf
authored andcommitted
Fix memory leak in zvol_set_volsize()
Move kmem_free() so it's called for every error path: this is preferred over making `dmu_object_info_t doi` local to accommodate older kernels with limited stacks. Reviewed by: Boris Protopopov <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Giuseppe Di Natale <[email protected]> Signed-off-by: loli10K <[email protected]> Closes openzfs#6177
1 parent 434c76c commit 3f7d041

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

module/zfs/zvol.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -419,11 +419,12 @@ zvol_set_volsize(const char *name, uint64_t volsize)
419419
goto out;
420420

421421
error = zvol_update_volsize(volsize, os);
422-
kmem_free(doi, sizeof (dmu_object_info_t));
423422

424423
if (error == 0 && zv != NULL)
425424
error = zvol_update_live_volsize(zv, volsize);
426425
out:
426+
kmem_free(doi, sizeof (dmu_object_info_t));
427+
427428
if (owned) {
428429
dmu_objset_disown(os, FTAG);
429430
if (zv != NULL)

0 commit comments

Comments
 (0)