[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251106143930.48e9ff2b@kernel.org>
Date: Thu, 6 Nov 2025 14:39:30 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Kuniyuki Iwashima <kuniyu@...gle.com>
Cc: syzbot+cif2d6d318f7e85f0b@...kaller.appspotmail.com,
davem@...emloft.net, edumazet@...gle.com, hoang.h.le@...tech.com.au,
horms@...nel.org, jmaloy@...hat.com, kuni1840@...il.com,
netdev@...r.kernel.org, pabeni@...hat.com, syzbot@...ts.linux.dev,
syzbot@...kaller.appspotmail.com, syzkaller-bugs@...glegroups.com,
tipc-discussion@...ts.sourceforge.net
Subject: Re: [syzbot ci] Re: tipc: Fix use-after-free in
tipc_mon_reinit_self().
On Thu, 6 Nov 2025 14:37:10 -0800 Kuniyuki Iwashima wrote:
> > On Thu, 6 Nov 2025 17:59:17 +0000 Kuniyuki Iwashima wrote:
> > > -void tipc_mon_reinit_self(struct net *net)
> > > +void tipc_mon_reinit_self(struct net *net, bool rtnl_held)
> > > {
> > > struct tipc_monitor *mon;
> > > int bearer_id;
> > >
> > > - rtnl_lock();
> > > + if (!rtnl_held)
> > > + rtnl_lock();
> >
> > I haven't looked closely but for the record conditional locking
> > is generally considered to be poor code design. Extract the body
> > into a __tipc_mon_reinit_self() helper and call that when lock
> > is already held? And:
> >
> > void tipc_mon_reinit_self(struct net *net)
> > {
> > rtnl_lock();
> > __tipc_mon_reinit_self(net);
> > rtnl_unlock();
> > }
>
> That's much cleaner, I'll use this.
After sending I realized you probably want to do this wrapping around
tipc_net_finalize(), otherwise we'd just be shifting the conditional.
But you get the point.. :)
Powered by blists - more mailing lists