Make sure to clear the IDPF_VPORT_UP bit on entry. The idpf_vport_stop() function is void and once called, the vport teardown is guaranteed to happen. Previously the bit was cleared at the end of the function, which opened it up to possible races with all instances in the driver where operations were conditional on this bit being set. For example, on rmmod callbacks in the middle of idpf_vport_stop() end up attempting to remove MAC address filter already removed by the function: idpf 0000:83:00.0: Received invalid MAC filter payload (op 536) (len 0) Fixes: 1c325aac10a8 ("idpf: configure resources for TX queues") Reviewed-by: Przemek Kitszel Reviewed-by: Aleksandr Loktionov Reviewed-by Joshua Hay Reviewed-by: Chittim Madhu Signed-off-by: Emil Tantilov --- drivers/net/ethernet/intel/idpf/idpf_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/net/ethernet/intel/idpf/idpf_lib.c b/drivers/net/ethernet/intel/idpf/idpf_lib.c index 89d30c395533..01ab42fa23f9 100644 --- a/drivers/net/ethernet/intel/idpf/idpf_lib.c +++ b/drivers/net/ethernet/intel/idpf/idpf_lib.c @@ -888,7 +888,7 @@ static void idpf_vport_stop(struct idpf_vport *vport) { struct idpf_netdev_priv *np = netdev_priv(vport->netdev); - if (!test_bit(IDPF_VPORT_UP, np->state)) + if (!test_and_clear_bit(IDPF_VPORT_UP, np->state)) return; netif_carrier_off(vport->netdev); @@ -911,7 +911,6 @@ static void idpf_vport_stop(struct idpf_vport *vport) idpf_vport_intr_deinit(vport); idpf_vport_queues_rel(vport); idpf_vport_intr_rel(vport); - clear_bit(IDPF_VPORT_UP, np->state); } /** -- 2.37.3