From: "Lin Ma" <linma@zju.edu.cn>
To: "Jakub Kicinski" <kuba@kernel.org>
Cc: netdev@vger.kernel.org, davem@davemloft.net,
jirislaby@kernel.org, gregkh@linuxfoundation.org,
linux-kernel@vger.kernel.org
Subject: Re: Re: [PATCH v1 2/2] hamradio: defer 6pack kfree after unregister_netdev
Date: Thu, 11 Nov 2021 10:09:59 +0800 (GMT+08:00) [thread overview]
Message-ID: <724aae55.1863af.17d0cc249ab.Coremail.linma@zju.edu.cn> (raw)
In-Reply-To: <20211110180612.2f2eb760@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Hi there,
> Sent Time: 2021-11-11 10:06:12 (Thursday)
> To: "Lin Ma" <linma@zju.edu.cn>
> Cc: netdev@vger.kernel.org, davem@davemloft.net, jirislaby@kernel.org, gregkh@linuxfoundation.org, linux-kernel@vger.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.
Oooops, thanks for the remind. XD
I just found that the mkill adds the free_netdev after the unregister_netdev so I did it too. No idea about this automatic cleanup.
Should I send the fix in this thread or open a new one?
Thanks
Lin
next prev parent reply other threads:[~2021-11-11 2:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 10:37 [PATCH v1 1/2] hamradio: defer ax25 " Lin Ma
2021-11-08 10:37 ` [PATCH v1 2/2] hamradio: defer 6pack " Lin Ma
2021-11-11 2:05 ` Jakub Kicinski
2021-11-11 2:06 ` Jakub Kicinski
2021-11-11 2:09 ` Lin Ma [this message]
2021-11-11 13:50 ` Jakub Kicinski
2021-11-11 14:01 ` Lin Ma
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=724aae55.1863af.17d0cc249ab.Coremail.linma@zju.edu.cn \
--to=linma@zju.edu.cn \
--cc=davem@davemloft.net \
--cc=gregkh@linuxfoundation.org \
--cc=jirislaby@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®