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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 11 Nov 2021 22:08:24 +0800 (GMT+08:00)
From:   "Lin Ma" <linma@....edu.cn>
To:     "Jakub Kicinski" <kuba@...nel.org>
Cc:     netdev@...r.kernel.org, davem@...emloft.net, jirislaby@...nel.org,
        gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: Re: [PATCH v0] hamradio: delete unnecessary free_netdev()

Hi Jakub

> On Thu, 11 Nov 2021 22:00:07 +0800 Lin Ma wrote:
> > The former patch "defer 6pack kfree after unregister_netdev" adds
> > free_netdev() function in sixpack_close(), which is a bad copy from the
> > similar code in mkiss_close(). However, this free is unnecessary as the
> > flag needs_free_netdev is set to true in sp_setup(), hence the
> > unregister_netdev() will free the netdev automatically.
> > 
> > Signed-off-by: Lin Ma <linma@....edu.cn>
> > ---
> >  drivers/net/hamradio/6pack.c | 2 --
> >  1 file changed, 2 deletions(-)
> > 
> > diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
> > index bfdf89e54752..180c8f08169b 100644
> > --- a/drivers/net/hamradio/6pack.c
> > +++ b/drivers/net/hamradio/6pack.c
> > @@ -677,8 +677,6 @@ static void sixpack_close(struct tty_struct *tty)
> >  	/* Free all 6pack frame buffers after unreg. */
> >  	kfree(sp->rbuff);
> >  	kfree(sp->xbuff);
> > -
> > -	free_netdev(sp->dev);
> 
> sp is netdev_priv() tho, so this is now a UAF. I'd go for removing the
> needs_free_netdev = true instead.
> 
> >  }
> >  
> >  /* Perform I/O control on an active 6pack channel. */

Okay, that make senses, wait a minute.

Thanks
Lin

Powered by blists - more mailing lists