Subject: Re: [PATCH net 3/8] idpf: fix possible race in idpf_vport_stop()

From: Jakub Kicinski <[email-masked]>
Date: Mon, 6 Oct 2025 10:26:59 -0700

On Mon, 6 Oct 2025 07:49:32 -0700 Tantilov, Emil S wrote:
> > Argh, please stop using the flag based state machines. They CANNOT
> > replace locking. If there was proper locking in place it wouldn't
> > have mattered when we clear the flag.  
> 
> This patch is resolving a bug in the current logic of how the flag is 
> used (not being atomic and not being cleared properly). I don't think
> there is an existing lock in place to address this issue, though we are
> looking to refactor the code over time to remove and/or limit how these
> flags are used.

Can you share more details about the race? If there is no lock in place
there's always the risk that:

  CPU 0                         CPU 1
 idpf_vport_stop()             whatever()
                                 if (test_bit(UP))
                                  # sees true
                                # !< long IRQ arrives
 test_and_clear(UP)
   ...
   all the rest
   ...
                                # > long IRQ ends
                                proceed but UP isn't really set any more