Re: [PATCH net-next 2/8] net: designate XSK pool pointers in queues as "ops protected"

Jakub Kicinski
2025-04-08T14:59:09Z

On Mon, 7 Apr 2025 19:17:36 -0700 Joe Damato wrote:
> > - xp_clear_dev(pool);
> > + if (netdev) {
> > + netdev_lock_ops(netdev);
> > + xp_clear_dev(pool);
> > + netdev_unlock_ops(netdev);
> > + }
> > rtnl_unlock();
>
> Is it actually possible for netdev to be NULL here?

So I've been told in v1 review :) I should have probably linked to
previous postings, these patches had been a part of various series
before.

The code is indeed buggy, tho, we need to move the netdev = pool->netdev
assignment under rtnl_lock..

> I feel like it probably isn't, but if it were possible we'd need an
> else case here to xp_clear_dev(pool) without the netdev_lock_ops?

It does nothing when netdev is null. Actually, due to "other changes"
all callers of xp_clear_dev() are now wrapped in the lock. We can
move the locking inside that helper.