# Re: \[PATCH net-next v10 04/14\] net: hold netdev instance lock during qdisc ndo\_setup\_tc

- From: Cosmin Ratiu \<hidden\>
- Date: 2025-05-05 15:12:43 
- List: netdev
- Page: https://ratatoskr.run/netdev/2025/05/11326460
- Thread: https://ratatoskr.run/netdev/2025/03/11321361/t.md

```text
On Mon, 2025-05-05 at 08:07 -0700, Stanislav Fomichev wrote:
> On 05/05, Cosmin Ratiu wrote:
> > diff --git a/net/core/dev.c b/net/core/dev.c
> > index d1a8cad0c99c..134ceddf7fa5 100644
> > --- a/net/core/dev.c
> > +++ b/net/core/dev.c
> > @@ -12020,9 +12020,9 @@ void
> > unregister_netdevice_many_notify(struct
> > list_head *head,
> >                 struct sk_buff *skb = NULL;
> >  
> >                 /* Shutdown queueing discipline. */
> > +               netdev_lock_ops(dev);
> >                 dev_shutdown(dev);
> >                 dev_tcx_uninstall(dev);
> 
> There is a synchronize_net hidden inside of dev_tcx_uninstall, so
> let's ops-lock only dev_shutdown here? Other than that, don't see
> anything wrong. Can you send this separately and target net tree?

Got it, so dev_tcx_uninstall can't be locked. I was trying to avoid
repeated locking/unlocking for various steps, but I guess it's
unavoidable. I think the ordering also can't change, qdiscs must be
shutdown before dev_tcx_uninstall, no? To avoid injecting new packets.

I will send the patch targeted to net later today, yes.

Cosmin.
```
