• Jason Gunthorpe's avatar
    IB/mlx5: Fix how advise_mr() launches async work · 951d01b9
    Jason Gunthorpe authored
    Work must hold a kref on the ib_device otherwise the dev pointer can
    become free before the work runs. This can happen because the work is
    being pushed onto the system work queue which is not flushed during driver
    unregister.
    
    Remove the bogus use of 'reg_state':
     - While in uverbs the reg_state is guaranteed to always be
       REGISTERED
     - Testing reg_state with no locking is bogus. Use ib_device_try_get()
       to get back into a region that prevents unregistration.
    
    For now continue with a flow that is similar to the existing code.
    
    Fixes: 813e90b1 ("IB/mlx5: Add advise_mr() support")
    Signed-off-by: default avatarJason Gunthorpe <jgg@mellanox.com>
    Reviewed-by: default avatarMoni Shoua <monis@mellanox.com>
    951d01b9
odp.c 41.6 KB