[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191008130830.718eeee8@cakuba.netronome.com>
Date: Tue, 8 Oct 2019 13:08:30 -0700
From: Jakub Kicinski <jakub.kicinski@...ronome.com>
To: Eric Dumazet <edumazet@...gle.com>
Cc: "David S . Miller" <davem@...emloft.net>,
netdev <netdev@...r.kernel.org>,
Eric Dumazet <eric.dumazet@...il.com>,
Jiri Pirko <jiri@...lanox.com>,
syzbot <syzkaller@...glegroups.com>
Subject: Re: [PATCH net-next] tun: fix memory leak in error path
On Tue, 8 Oct 2019 12:47:56 -0700, Eric Dumazet wrote:
> On Tue, Oct 8, 2019 at 12:31 PM Jakub Kicinski wrote:
> > On Mon, 7 Oct 2019 12:21:05 -0700, Eric Dumazet wrote:
> > > syzbot reported a warning [1] that triggered after recent Jiri patch.
> > >
> > > This exposes a bug that we hit already in the past (see commit
> > > ff244c6b29b1 ("tun: handle register_netdevice() failures properly")
> > > for details)
> > >
> > > tun uses priv->destructor without an ndo_init() method.
> > >
> > > register_netdevice() can return an error, but will
> > > not call priv->destructor() in some cases. Jiri recent
> > > patch added one more.
> > >
> > > A long term fix would be to transfer the initialization
> > > of what we destroy in ->destructor() in the ndo_init()
> > >
> > > This looks a bit risky given the complexity of tun driver.
> > >
> > > A simpler fix is to detect after the failed register_netdevice()
> > > if the tun_free_netdev() function was called already.
> > >
> > > [...]
> > >
> > > Fixes: ff92741270bf ("net: introduce name_node struct to be used in hashlist")
> > > Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> > > Cc: Jiri Pirko <jiri@...lanox.com>
> > > Reported-by: syzbot <syzkaller@...glegroups.com>
> >
> > Looks good, obviously. Presumably we could remove the workaround added
> > by commit 0ad646c81b21 ("tun: call dev_get_valid_name() before
> > register_netdevice()") at this point? What are your thoughts on that?
>
> This is indeed something that could be done now, maybe by an independent revert.
Independent revert seems like the best idea.
Applied this one, thanks!
Powered by blists - more mailing lists