]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nvme: Free ctrl device name on init failure
authorKeith Busch <keith.busch@intel.com>
Mon, 26 Nov 2018 23:39:47 +0000 (16:39 -0700)
committerMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
Fri, 17 Jan 2020 17:22:58 +0000 (14:22 -0300)
BugLink: https://bugs.launchpad.net/bugs/1857158
[ Upstream commit d6a2b9535d1e52bea269c138614c4801469d10e1 ]

Free the kobject name that was allocated for the controller device on
failure rather than its parent.

Fixes: d22524a4782a9 ("nvme: switch controller refcounting to use struct device")
Signed-off-by: Keith Busch <keith.busch@intel.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
drivers/nvme/host/core.c

index 540dfb2a379cf8f5fcfd7e188861d185d5951214..52b1635a5a52ab76f7754d24195d4f805300e324 100644 (file)
@@ -3402,7 +3402,7 @@ int nvme_init_ctrl(struct nvme_ctrl *ctrl, struct device *dev,
 
        return 0;
 out_free_name:
-       kfree_const(dev->kobj.name);
+       kfree_const(ctrl->device->kobj.name);
 out_release_instance:
        ida_simple_remove(&nvme_instance_ida, ctrl->instance);
 out: