nvme-rdma: stop admin queue before freeing it
authorJianchao Wang <jianchao.w.wang@oracle.com>
Thu, 24 May 2018 01:27:38 +0000 (09:27 +0800)
committerChristoph Hellwig <hch@lst.de>
Fri, 25 May 2018 14:50:12 +0000 (16:50 +0200)
commit2e050f00a0f0e07467050cb4afae0234941e5bf3
treed4758c5ca476451664c39c938f83d08cecae86cd
parent72cd4cc28e234ed7189ee508ed65ab60c80a97c8
nvme-rdma: stop admin queue before freeing it

For any failure after nvme_rdma_start_queue in
nvme_rdma_configure_admin_queue, the admin queue will be freed with the
NVME_RDMA_Q_LIVE flag still set.  Once nvme_rdma_stop_queue is invoked,
that will cause a use-after-free.
BUG: KASAN: use-after-free in rdma_disconnect+0x1f/0xe0 [rdma_cm]

To fix it, call nvme_rdma_stop_queue for all the failed cases after
nvme_rdma_start_queue.

Signed-off-by: Jianchao Wang <jianchao.w.wang@oracle.com>
Suggested-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c