[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAAVpQUBVyWBr6PqAOw7Js9_Jg4fDvVTvuJzoZ_ZCw0YKG2KWhQ@mail.gmail.com>
Date: Thu, 6 Nov 2025 14:51:48 -0800
From: Kuniyuki Iwashima <kuniyu@...gle.com>
To: Jakub Kicinski <kuba@...nel.org>
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, Nov 6, 2025 at 2:39 PM Jakub Kicinski <kuba@...nel.org> wrote:
>
> 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.. :)
Yes, will wrap it in tipc_net_finalize_work() :)
Powered by blists - more mailing lists