• Wen Gu's avatar
    net/smc: Stop the CLC flow if no link to map buffers on · e738455b
    Wen Gu authored
    There might be a potential race between SMC-R buffer map and
    link group termination.
    
    smc_smcr_terminate_all()     | smc_connect_rdma()
    --------------------------------------------------------------
                                 | smc_conn_create()
    for links in smcibdev        |
            schedule links down  |
                                 | smc_buf_create()
                                 |  \- smcr_buf_map_usable_links()
                                 |      \- no usable links found,
                                 |         (rmb->mr = NULL)
                                 |
                                 | smc_clc_send_confirm()
                                 |  \- access conn->rmb_desc->mr[]->rkey
                                 |     (panic)
    
    During reboot and IB device module remove, all links will be set
    down and no usable links remain in link groups. In such situation
    smcr_buf_map_usable_links() should return an error and stop the
    CLC flow accessing to uninitialized mr.
    
    Fixes: b9247544 ("net/smc: convert static link ID instances to support multiple links")
    Signed-off-by: default avatarWen Gu <guwen@linux.alibaba.com>
    Link: https://lore.kernel.org/r/1663656189-32090-1-git-send-email-guwen@linux.alibaba.comSigned-off-by: default avatarPaolo Abeni <pabeni@redhat.com>
    e738455b
smc_core.c 67.9 KB