lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89iLzMCgkKLGjnyZ8YMd4ft81sfQyueC52TROuVx0ua0qYg@mail.gmail.com>
Date: Wed, 4 Dec 2024 17:09:40 +0100
From: Eric Dumazet <edumazet@...gle.com>
To: Kuniyuki Iwashima <kuniyu@...zon.com>
Cc: davem@...emloft.net, ebiederm@...ssion.com, jmaloy@...hat.com, 
	kuba@...nel.org, kuni1840@...il.com, netdev@...r.kernel.org, 
	pabeni@...hat.com, syzkaller@...glegroups.com, 
	tipc-discussion@...ts.sourceforge.net, ying.xue@...driver.com
Subject: Re: [PATCH v2 net] tipc: Fix use-after-free of kernel socket in cleanup_bearer().

On Wed, Dec 4, 2024 at 5:00 PM Kuniyuki Iwashima <kuniyu@...zon.com> wrote:
>
> From: Eric Dumazet <edumazet@...gle.com>
> Date: Wed, 4 Dec 2024 16:01:10 +0100
> > > diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c
> > > index 439f75539977..b7e25e7e9933 100644
> > > --- a/net/tipc/udp_media.c
> > > +++ b/net/tipc/udp_media.c
> > > @@ -814,10 +814,10 @@ static void cleanup_bearer(struct work_struct *work)
> > >                 kfree_rcu(rcast, rcu);
> > >         }
> > >
> > > -       atomic_dec(&tipc_net(sock_net(ub->ubsock->sk))->wq_count);
> > >         dst_cache_destroy(&ub->rcast.dst_cache);
> > >         udp_tunnel_sock_release(ub->ubsock);
> > >         synchronize_net();
> > > +       atomic_dec(&tipc_net(sock_net(ub->ubsock->sk))->wq_count);
> >
> > Note that ub->ubsock->sk is NULL at this point.
> >
> > I am testing the following fix, does it make sense to you ?
>
> Ah yes, net needs to be cached before sock_release().
>
> Thanks for catching this !
>


BTW the following construct in tipc_exit_net()

while (atomic_read(&tn->wq_count))
     cond_resched();

should really be replaced by a completion or something like that :/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ