[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Wed, 10 Nov 2021 18:06:12 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Lin Ma <linma@....edu.cn>
Cc: netdev@...r.kernel.org, davem@...emloft.net, jirislaby@...nel.org,
gregkh@...uxfoundation.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v1 2/2] hamradio: defer 6pack kfree after
unregister_netdev
On Wed, 10 Nov 2021 18:05:25 -0800 Jakub Kicinski wrote:
> > diff --git a/drivers/net/hamradio/6pack.c b/drivers/net/hamradio/6pack.c
> > index 49f10053a794..bfdf89e54752 100644
> > --- a/drivers/net/hamradio/6pack.c
> > +++ b/drivers/net/hamradio/6pack.c
> > @@ -672,11 +672,13 @@ static void sixpack_close(struct tty_struct *tty)
> > del_timer_sync(&sp->tx_t);
> > del_timer_sync(&sp->resync_t);
> >
> > - /* Free all 6pack frame buffers. */
> > + unregister_netdev(sp->dev);
> > +
> > + /* Free all 6pack frame buffers after unreg. */
> > kfree(sp->rbuff);
> > kfree(sp->xbuff);
> >
> > - unregister_netdev(sp->dev);
> > + free_netdev(sp->dev);
>
> You should mention in the commit message why you think it's safe to add
> free_netdev() which wasn't here before...
>
> This driver seems to be setting:
>
> dev->needs_free_netdev = true;
>
> so unregister_netdev() will free the netdev automatically.
>
> That said I don't see a reason why this driver needs the automatic
> cleanup.
>
> You can either remove that setting and then you can call free_netdev()
> like you do, or you need to move the cleanup to dev->priv_destructor.
Looks like this go applied already, please send a follow up fix.
Powered by blists - more mailing lists