• Karsten Graul's avatar
    net/smc: fix wait on already cleared link · 8f3d65c1
    Karsten Graul authored
    There can be a race between the waiters for a tx work request buffer
    and the link down processing that finally clears the link. Although
    all waiters are woken up before the link is cleared there might be
    waiters which did not yet get back control and are still waiting.
    This results in an access to a cleared wait queue head.
    
    Fix this by introducing atomic reference counting around the wait calls,
    and wait with the link clear processing until all waiters have finished.
    Move the work request layer related calls into smc_wr.c and set the
    link state to INACTIVE before calling smcr_link_clear() in
    smc_llc_srv_add_link().
    
    Fixes: 15e1b99a ("net/smc: no WR buffer wait for terminating link group")
    Signed-off-by: default avatarKarsten Graul <kgraul@linux.ibm.com>
    Signed-off-by: default avatarGuvenc Gulce <guvenc@linux.ibm.com>
    Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
    8f3d65c1
smc_core.h 15.1 KB