Subject: Re: [PATCH net] netdev: prevent accessing NAPI instances from another namespace

From: Jakub Kicinski <[email-masked]>
Date: Tue, 7 Jan 2025 08:36:09 -0800

On Tue, 07 Jan 2025 08:10:36 -0500 Willem de Bruijn wrote:
> > +/* must be called under rcu_read_lock(), as we dont take a reference */  
> 
> Instead of function comments, invariant checks in code?
> 
> Like in dev_get_by_napi_id:
> 
>         WARN_ON_ONCE(!rcu_read_lock_held());

Can I do it as a follow up? Adding the warning to napi_by_id()
reveals that napi_hash_add() currently walks the list without
holding the RCU lock :)