]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commitc1e391ba1e1632d7da51a51e39df81382640b9ee
treed4758c5ca476451664c39c938f83d08cecae86cd
parentcc5193992c71f5b0c6058548bba3a9931c5c426d
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