From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Wang Subject: Re: [Patch net v3] tun: fix a memory leak for tfile->tx_array Date: Tue, 16 Jan 2018 14:12:53 +0800 Message-ID: <30c120dd-d577-02ed-dcad-4827bde3beb3@redhat.com> References: <20180115193729.13220-1-xiyou.wangcong@gmail.com> <3c47b1dd-f8ae-87a7-a498-467b9027dcbc@redhat.com> <16b82836-7e07-c13c-cd7b-917eaa06d224@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Cc: Linux Kernel Network Developers , Dmitry Vyukov To: Cong Wang Return-path: Received: from mx1.redhat.com ([209.132.183.28]:41954 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750708AbeAPGM6 (ORCPT ); Tue, 16 Jan 2018 01:12:58 -0500 In-Reply-To: Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 2018年01月16日 14:07, Cong Wang wrote: > On Mon, Jan 15, 2018 at 10:00 PM, Jason Wang wrote: >> I mean we can leave __tun_detach() as is, and just add the cleanup to >> tun_detach_all(). This is because in both cases, we're sure skb array has >> been initialized before. >> > Oh, I thought the same before sending v3, but I believe it is easier to > understand 'if (tfile->tx_array.ring.queue)' than 'if (tun)', because tx_array > only depends on itself rather tfile->tun in this way. Maybe just add a comment to explain in __tun_detach(), it avoids memset() anyway. Thanks