• Chao Leng's avatar
    nvme-rdma: fix crash when connect rejected · 43efdb8e
    Chao Leng authored
    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: default avatarChao Leng <lengchao@huawei.com>
    Reviewed-by: default avatarSagi Grimberg <sagi@grimberg.me>
    Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
    43efdb8e
rdma.c 64.5 KB