Subject: Re: [PATCH net] rtnetlink: fix leak of SRCU struct in rtnl_link_register

From: Jakub Kicinski <[email-masked]>
Date: Fri, 20 Mar 2026 17:35:01 -0700

On Fri, 20 Mar 2026 08:23:42 +0100 Sabrina Dubroca wrote:
> 2026-03-19, 17:05:41 -0700, Jakub Kicinski wrote:
> > On Wed, 18 Mar 2026 17:15:15 +0100 Sabrina Dubroca wrote:  
> > >  	list_add_tail_rcu(&ops->list, &link_ops);
> > >  unlock:
> > > +	if (err)
> > > +		cleanup_srcu_struct(&ops->srcu);
> > > +
> > >  	mutex_unlock(&link_ops_mutex);  
> > 
> > Does the cleanup have to be under the lock?  
> 
> Right. I'll send a v2.

SG, I'll mark this as Changes Requested then.

> (OTOH I don't think we'll ever have to worry about contention on this
> lock, but we've probably said that about many locks in the past)

Right. I'm not sure why I feel this way but the way the condition is
placed makes it read to me as if being under the lock was important :S