From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id CE362569D for ; Thu, 26 Mar 2015 08:53:19 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by orsmga101.jf.intel.com with ESMTP; 26 Mar 2015 00:53:19 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,470,1422950400"; d="scan'208";a="698035814" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by fmsmga002.fm.intel.com with ESMTP; 26 Mar 2015 00:53:09 -0700 Received: from shsmsx103.ccr.corp.intel.com (10.239.4.69) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.224.2; Thu, 26 Mar 2015 15:53:07 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.36]) by SHSMSX103.ccr.corp.intel.com ([169.254.4.108]) with mapi id 14.03.0224.002; Thu, 26 Mar 2015 15:53:06 +0800 From: "Xie, Huawei" To: Pavel Boldin Thread-Topic: [dpdk-dev] [PATCH] vhost: Fix `struct file' leakage in `eventfd_link' Thread-Index: AQHQZk5rHEc8cQdEDUaJ8evKn4WrEg== Date: Thu, 26 Mar 2015 07:53:06 +0000 Message-ID: References: <1427115225-14489-1-git-send-email-pboldin@mirantis.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Cc: "dev@dpdk.org" Subject: Re: [dpdk-dev] [PATCH] vhost: Fix `struct file' leakage in `eventfd_link' X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 26 Mar 2015 07:53:20 -0000 On 3/25/2015 4:08 AM, Pavel Boldin wrote: On Tue, Mar 24, 2015 at 6:20 PM, Xie, Huawei > wrote: On 3/24/2015 7:10 PM, Pavel Boldin wrote: On Tue, Mar 24, 2015 at 8:28 AM, Xie, Huawei >> wrote: On 3/23/2015 8:54 PM, Pavel Boldin wrote: > Due to increased `struct file's reference counter subsequent call > to `filp_close' does not free the `struct file'. Prepend `fput' call > to decrease the reference counter. > > Signed-off-by: Pavel Boldin >> > --- > lib/librte_vhost/eventfd_link/eventfd_link.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c b/lib/librte_vh= ost/eventfd_link/eventfd_link.c > index 7755dd6..62c45c8 100644 > --- a/lib/librte_vhost/eventfd_link/eventfd_link.c > +++ b/lib/librte_vhost/eventfd_link/eventfd_link.c > @@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl= , unsigned long arg) > * Release the existing eventfd in the source process > */ > spin_lock(&files->file_lock); > + fput(file); > filp_close(file, files); > fdt =3D files_fdtable(files); > fdt->fd[eventfd_copy.source_fd] =3D NULL; Acked-by Huawei Xie >> In future, we should remove the allocation of src eventfd, allocate a free fd from kernel, and install it with target fd. Well, I don't think this is correct, because this will put too much job for= the kernel module making it a combiner. At the moment I propose to accept module refactoring patch to the upstream. After that the module can be reworked along with the application code. The = reason is I can't work on DPDK since I have no hardware to test application= at so I can't help with patch that touches application code. Pavel Pavel: I am not asking to do it right now but in future, and i agree we accept the= refactoring patch now, so i ack the patch. Huawei, this is the refactoring patch [1]. This patch is merely a bugfix. [1] http://dpdk.org/dev/patchwork/patch/4113/ Huawei Thanks for your patch and fd checking tool. I will re-ack the patch as i se= e quoting issue in my previous ack.