nvmet-rdma: Fix list_del corruption on queue establishment failure
authorIsrael Rukshin <israelr@nvidia.com>
Tue, 5 Jan 2021 08:46:54 +0000 (10:46 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Jan 2021 17:27:26 +0000 (18:27 +0100)
commit8e57baf3cdb3f752f92b424b8e6154b81723e267
treec40b28b6bc3d21c9b1fd957dcf209e87a9033fc0
parent74310d40e0a41483dc7125347a9ccc249655fd85
nvmet-rdma: Fix list_del corruption on queue establishment failure

[ Upstream commit 9ceb7863537748c67fa43ac4f2f565819bbd36e4 ]

When a queue is in NVMET_RDMA_Q_CONNECTING state, it may has some
requests at rsp_wait_list. In case a disconnect occurs at this
state, no one will empty this list and will return the requests to
free_rsps list. Normally nvmet_rdma_queue_established() free those
requests after moving the queue to NVMET_RDMA_Q_LIVE state, but in
this case __nvmet_rdma_queue_disconnect() is called before. The
crash happens at nvmet_rdma_free_rsps() when calling
list_del(&rsp->free_list), because the request exists only at
the wait list. To fix the issue, simply clear rsp_wait_list when
destroying the queue.

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>
drivers/nvme/target/rdma.c