• Sean Hefty's avatar
    RDMA/cma: Add locking around QP accesses · c5483388
    Sean Hefty authored
    If a user allocates a QP on an rdma_cm_id, the rdma_cm will automatically
    transition the QP through its states (RTR, RTS, error, etc.)  While the
    QP state transitions are occurring, the QP itself must remain valid.
    Provide locking around the QP pointer to prevent its destruction while
    accessing the pointer.
    
    This fixes an issue reported by Olaf Kirch from Oracle that resulted in
    a system crash:
    
    "An incoming connection arrives and we decide to tear down the nascent
     connection.  The remote ends decides to do the same.  We start to shut
     down the connection, and call rdma_destroy_qp on our cm_id. ... Now
     apparently a 'connect reject' message comes in from the other host,
     and cma_ib_handler() is called with an event of IB_CM_REJ_RECEIVED.
     It calls cma_modify_qp_err, which for some odd reason tries to modify
     the exact same QP we just destroyed."
    Signed-off-by: default avatarSean Hefty <sean.hefty@intel.com>
    Signed-off-by: default avatarRoland Dreier <rolandd@cisco.com>
    c5483388
cma.c 69.7 KB