]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commit
nvmet-tcp: fix use-after-free when a port is removed
authorIsrael Rukshin <israelr@nvidia.com>
Wed, 6 Oct 2021 08:09:45 +0000 (08:09 +0000)
committerKleber Sacilotto de Souza <kleber.souza@canonical.com>
Thu, 13 Jan 2022 17:42:12 +0000 (18:42 +0100)
commit642c92318d4ea21cb16cd8057fd0365159510a4f
tree2e7b46f232483c64a34e7321aeecf9434ec26e7d
parent9a3bd8c0df87e0182a897568129861ceb4da9a7a
nvmet-tcp: fix use-after-free when a port is removed

BugLink: https://bugs.launchpad.net/bugs/1953387
[ Upstream commit 2351ead99ce9164fb42555aee3f96af84c4839e9 ]

When removing a port, all its controllers are being removed, but there
are queues on the port that doesn't belong to any controller (during
connection time). This causes a use-after-free bug for any command
that dereferences req->port (like in nvmet_alloc_ctrl). Those queues
should be destroyed before freeing the port via configfs. Destroy
the remaining queues after the accept_work was cancelled guarantees
that no new queue will be created.

Signed-off-by: Israel Rukshin <israelr@nvidia.com>
Reviewed-by: Max Gurtovoy <mgurtovoy@nvidia.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: Kelsey Skunberg <kelsey.skunberg@canonical.com>
drivers/nvme/target/tcp.c