]> git.baikalelectronics.ru Git - kernel.git/commit
nvme-rdma: fix crash when connect rejected
authorChao Leng <lengchao@huawei.com>
Mon, 12 Oct 2020 08:10:40 +0000 (16:10 +0800)
committerChristoph Hellwig <hch@lst.de>
Thu, 22 Oct 2020 13:27:13 +0000 (15:27 +0200)
commit501eb072e200337123064d33ef9027ebe0dfdf1e
tree58d20765edc2c65c0183e425e1ef1a0c6cab4018
parent26bb5a69686e0b030a966ab13e0663dc3fdfacd4
nvme-rdma: fix crash when connect rejected

A crash can happened when a connect is rejected.   The host establishes
the connection after received ConnectReply, and then continues to send
the fabrics Connect command.  If the controller does not receive the
ReadyToUse capsule, host may receive a ConnectReject reply.

Call nvme_rdma_destroy_queue_ib after the host received the
RDMA_CM_EVENT_REJECTED event.  Then when the fabrics Connect command
times out, nvme_rdma_timeout calls nvme_rdma_complete_rq to fail the
request.  A crash happenes due to use after free in
nvme_rdma_complete_rq.

nvme_rdma_destroy_queue_ib is redundant when handling the
RDMA_CM_EVENT_REJECTED event as nvme_rdma_destroy_queue_ib is already
called in connection failure handler.

Signed-off-by: Chao Leng <lengchao@huawei.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/rdma.c