]> git.baikalelectronics.ru Git - kernel.git/commit
nvmet-rdma: fix double free of rdma queue
authorIsrael Rukshin <israelr@mellanox.com>
Tue, 7 Apr 2020 11:02:28 +0000 (11:02 +0000)
committerChristoph Hellwig <hch@lst.de>
Tue, 7 Apr 2020 16:33:45 +0000 (18:33 +0200)
commit991c121ea41bb87ecc9cdcd6ab061ba35c7c79ab
tree47ba0de634076493732a837506da4bc25fe880a8
parent7836d506357bde941d0303244f6db1ca213da449
nvmet-rdma: fix double free of rdma queue

In case rdma accept fails at nvmet_rdma_queue_connect(), release work is
scheduled. Later on, a new RDMA CM event may arrive since we didn't
destroy the cm-id and call nvmet_rdma_queue_connect_fail(), which
schedule another release work. This will cause calling
nvmet_rdma_free_queue twice. To fix this we implicitly destroy the cm_id
with non-zero ret code, which guarantees that new rdma_cm events will
not arrive afterwards. Also add a qp pointer to nvmet_rdma_queue
structure, so we can use it when the cm_id pointer is NULL or was
destroyed.

Signed-off-by: Israel Rukshin <israelr@mellanox.com>
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/target/rdma.c