nvme: fix controller instance leak
authorKeith Busch <kbusch@kernel.org>
Wed, 26 Aug 2020 17:53:04 +0000 (10:53 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 9 Sep 2020 17:14:19 +0000 (19:14 +0200)
commit4aa6128188fb3684db58490364af147db8b02020
tree79be30d049e32690b2fdf5f8506715642954565e
parentdb8c729bca37919fbe21536af5f484a9580f1136
nvme: fix controller instance leak

[ Upstream commit 192f6c29bb28bfd0a17e6ad331d09f1ec84143d0 ]

If the driver has to unbind from the controller for an early failure
before the subsystem has been set up, there won't be a subsystem holding
the controller's instance, so the controller needs to free its own
instance in this case.

Fixes: 733e4b69d508d ("nvme: Assign subsys instance from first ctrl")
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c