[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <8b49292d-6176-fc10-0a91-3a6d78558d7d@huawei.com>
Date: Tue, 1 Dec 2020 21:47:04 +0800
From: Yang Yingliang <yangyingliang@...wei.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
CC: Netdev <netdev@...r.kernel.org>,
David Miller <davem@...emloft.net>,
"Jakub Kicinski" <kuba@...nel.org>, <toshiaki.makita1@...il.com>,
<rkovhaev@...il.com>
Subject: Re: [PATCH net v2 1/2] wireguard: device: don't call free_netdev() in
priv_destructor()
On 2020/12/1 17:46, Jason A. Donenfeld wrote:
> Hi Yang,
>
> On Tue, Dec 1, 2020 at 10:31 AM Yang Yingliang <yangyingliang@...wei.com> wrote:
>> After commit cf124db566e6 ("net: Fix inconsistent teardown and..."),
>> priv_destruct() doesn't call free_netdev() in driver, we use
>> dev->needs_free_netdev to indicate whether free_netdev() should be
>> called on release path.
>> This patch remove free_netdev() from priv_destructor() and set
>> dev->needs_free_netdev to true.
> For now, nack.
>
> I remember when cf124db566e6 came out and carefully looking at the
> construction of device.c in WireGuard. priv_destructor is only
> assigned after register_device, with the various error paths in
> wg_newlink responsible for cleaning up other earlier failures, and
> trying to move to needs_free_netdev would have introduced more
> complexity in this particular case, if my memory serves. I do not
> think there's a memory leak here, and I worry about too hastily
> changing the state machine "just because".
>
> In other words, could you point out how to generate a memory leak? If
> you're correct, then we can start dissecting and refactoring this. But
> off the bat, I'm not sure I'm exactly seeing whatever you're seeing.
Yes, I missed that priv_destructor is only assigned after
register_netdevice(),
so, it will not lead a double free in my patch#2, so this patch can be
dropped and
send v3.
>
> Jason
> .
Powered by blists - more mailing lists