]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Fix bad kmem_free() in zvol_rename_minors_impl()
authorTom Caputi <tcaputi@datto.com>
Wed, 23 Jan 2019 19:38:05 +0000 (14:38 -0500)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 23 Jan 2019 19:38:05 +0000 (11:38 -0800)
Currently, zvol_rename_minors_impl() calls kmem_asprintf()
to allocate and initialize a string. This function is a thin
wrapper around the kernel's kvasprintf() and does not call
into the SPL's kmem tracking code when it is enabled. However,
this function frees the string with the tracked kmem_free()
instead of the untracked strfree(), which causes the SPL
kmem tracking code to believe that the function is attempting
to free memory it never allocated, triggering an ASSERT. This
patch simply corrects this issue.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Tom Caputi <tcaputi@datto.com>
Closes #8307

module/zfs/zvol.c

index 7395dcb8ddcb67a9e63fa6f3554162eecf432c7a..7ca18e138cc2013d5705a62e5824cdc7a04e93a8 100644 (file)
@@ -2267,7 +2267,7 @@ zvol_rename_minors_impl(const char *oldname, const char *newname)
                            zv->zv_name[oldnamelen],
                            zv->zv_name + oldnamelen + 1);
                        zvol_rename_minor(zv, name);
-                       kmem_free(name, strlen(name + 1));
+                       strfree(name);
                }
 
                mutex_exit(&zv->zv_state_lock);