• Jacob Keller's avatar
    i40evf: hold the critical task bit lock while opening · 9b2aef12
    Jacob Keller authored
    If i40evf_open() is called quickly at the same time as a reset occurs
    (such as via ethtool) it is possible for the device to attempt to open
    while a reset is in progress. This occurs because the driver was not
    holding the critical task bit lock during i40evf_open, nor was it
    holding it around the call to i40evf_up_complete() in
    i40evf_reset_task().
    
    We didn't hold the lock previously because calls to i40evf_down() would
    take the bit lock directly, and this would have caused a deadlock.
    
    To avoid this, we'll move the bit lock handling out of i40evf_down() and
    into the callers of this function. Additionally, we'll now hold the bit
    lock over the entire set of steps when going up or down, to ensure that
    we remain consistent.
    
    Ultimately this causes us to serialize the transitions between down and
    up properly, and avoid changing status while we're resetting.
    Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
    Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
    Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
    9b2aef12
i40evf_main.c 87.7 KB