[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251028164437.20b48513@kernel.org>
Date: Tue, 28 Oct 2025 16:44:37 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: David Wei <dw@...idwei.uk>
Cc: Daniel Borkmann <daniel@...earbox.net>, Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org, bpf@...r.kernel.org, davem@...emloft.net,
razor@...ckwall.org, willemb@...gle.com, sdf@...ichev.me,
john.fastabend@...il.com, martin.lau@...nel.org, jordan@...fe.io,
maciej.fijalkowski@...el.com, magnus.karlsson@...el.com, toke@...hat.com,
yangzhenze@...edance.com, wangdongdong.6@...edance.com
Subject: Re: [PATCH net-next v3 02/15] net: Implement
netdev_nl_bind_queue_doit
On Tue, 28 Oct 2025 14:59:05 -0700 David Wei wrote:
> On 2025-10-23 19:08, Jakub Kicinski wrote:
> > On Thu, 23 Oct 2025 14:48:15 +0200 Daniel Borkmann wrote:
> >> It is needed given we need to always ensure lock ordering for the two devices,
> >> that is, the order is always from the virtual to the physical device.
> >
> > You do seem to be taking the lock before you check if the device was
> > the type you expected tho.
>
> I believe this is okay. Let's say we have two netdevs, A that is real
> and B that is virtual.
Now imagine they are both virtual.
> User calls netdev_nl_bind_queue_doit() twice in
> two different contexts, 1 with the correct order (A as src, B as dst)
> and 2 with the incorrect order (B as src, A as dst). We always try to
> lock dst first, then src.
>
> 1 2
> lock(dst == B)
> lock(dst == A)
> is not virtual...
> unlock(A)
> lock(src == A)
>
>
> 1 2
> lock(dst == A)
> lock(dst == B)
> is not virtual...
> unlock(A)
> lock(src == A)
>
> The check will prevent ABBA by never taking that final lock to complete
> the cycle. Please check and lmk if I'm off, stuff like this makes my
> brain hurt.
Powered by blists - more mailing lists