]> git.baikalelectronics.ru Git - kernel.git/commit
nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set
authorMaurizio Lombardi <mlombard@redhat.com>
Fri, 27 Jan 2023 15:42:37 +0000 (16:42 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Feb 2023 11:59:44 +0000 (12:59 +0100)
commit8e152b1994a419df1bd24ea21941039c2c29799b
tree2607126021e4112770519858b91719773dd052f1
parent4b9c5cdcf24aa4b4e86a991327348bb81be8f34a
nvme: clear the request_queue pointers on failure in nvme_alloc_admin_tag_set

[ Upstream commit e6516c3f85d6504b5407ee26cfe780b4be3e30b9 ]

If nvme_alloc_admin_tag_set() fails, the admin_q and fabrics_q pointers
are left with an invalid, non-NULL value. Other functions may then check
the pointers and dereference them, e.g. in

  nvme_probe() -> out_disable: -> nvme_dev_remove_admin().

Fix the bug by setting admin_q and fabrics_q to NULL in case of error.

Also use the set variable to free the tag_set as ctrl->admin_tagset isn't
initialized yet.

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Chaitanya Kulkarni <kch@nvidia.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/nvme/host/core.c