nvme-rdma: fix memory leak during queue allocation
authorMax Gurtovoy <maxg@mellanox.com>
Tue, 28 Nov 2017 16:28:44 +0000 (18:28 +0200)
committerChristoph Hellwig <hch@lst.de>
Tue, 28 Nov 2017 16:49:22 +0000 (08:49 -0800)
commiteb1bd249ba016284ed762d87c1989dd822500773
tree520a3360446477d4e142447dd8afab8a2040700c
parentf41725bbe16b0773302c0cc7dc2e89f54828712d
nvme-rdma: fix memory leak during queue allocation

In case nvme_rdma_wait_for_cm timeout expires before we get
an established or rejected event (rdma_connect succeeded) from
rdma_cm, we end up with leaking the ib transport resources for
dedicated queue. This scenario can easily reproduced using traffic
test during port toggling.
Also, in order to protect from parallel ib queue destruction, that
may be invoked from different context's, introduce new flag that
stands for transport readiness. While we're here, protect also against
a situation that we can receive rdma_cm events during ib queue destruction.

Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c