From: Keith Busch Date: Mon, 26 Nov 2018 23:39:47 +0000 (-0700) Subject: nvme: Free ctrl device name on init failure X-Git-Tag: v4.19.89~144 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=0e6ec8b39105ef5f63a9af25a60fc2f7d2a682a2;p=thirdparty%2Fkernel%2Fstable.git nvme: Free ctrl device name on init failure [ 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 Signed-off-by: Christoph Hellwig Signed-off-by: Sasha Levin --- diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index c4ff4f079448e..b2d9bd564960a 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -3652,7 +3652,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: