From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 380029AB1 for ; Tue, 24 Mar 2015 07:28:44 +0100 (CET) Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga103.fm.intel.com with ESMTP; 23 Mar 2015 23:28:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,456,1422950400"; d="scan'208";a="696761050" Received: from pgsmsx101.gar.corp.intel.com ([10.221.44.78]) by fmsmga002.fm.intel.com with ESMTP; 23 Mar 2015 23:28:40 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by PGSMSX101.gar.corp.intel.com (10.221.44.78) with Microsoft SMTP Server (TLS) id 14.3.224.2; Tue, 24 Mar 2015 14:28:34 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.36]) by shsmsx102.ccr.corp.intel.com ([169.254.2.198]) with mapi id 14.03.0224.002; Tue, 24 Mar 2015 14:28:33 +0800 From: "Xie, Huawei" To: Pavel Boldin , "dev@dpdk.org" , "Long, Thomas" Thread-Topic: [dpdk-dev] [PATCH] vhost: Fix `struct file' leakage in `eventfd_link' Thread-Index: AdBl+7+rPVYoudlue02yvo5DCI00vw== Date: Tue, 24 Mar 2015 06:28:32 +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 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: Tue, 24 Mar 2015 06:28:45 -0000 On 3/23/2015 8:54 PM, Pavel Boldin wrote:=0A= > Due to increased `struct file's reference counter subsequent call=0A= > to `filp_close' does not free the `struct file'. Prepend `fput' call=0A= > to decrease the reference counter.=0A= >=0A= > Signed-off-by: Pavel Boldin =0A= > ---=0A= > lib/librte_vhost/eventfd_link/eventfd_link.c | 1 +=0A= > 1 file changed, 1 insertion(+)=0A= >=0A= > diff --git a/lib/librte_vhost/eventfd_link/eventfd_link.c b/lib/librte_vh= ost/eventfd_link/eventfd_link.c=0A= > index 7755dd6..62c45c8 100644=0A= > --- a/lib/librte_vhost/eventfd_link/eventfd_link.c=0A= > +++ b/lib/librte_vhost/eventfd_link/eventfd_link.c=0A= > @@ -117,6 +117,7 @@ eventfd_link_ioctl(struct file *f, unsigned int ioctl= , unsigned long arg)=0A= > * Release the existing eventfd in the source process=0A= > */=0A= > spin_lock(&files->file_lock);=0A= > + fput(file);=0A= > filp_close(file, files);=0A= > fdt =3D files_fdtable(files);=0A= > fdt->fd[eventfd_copy.source_fd] =3D NULL;=0A= Acked-by Huawei Xie =0A= =0A= In future, we should remove the allocation of src eventfd, allocate a=0A= free fd from kernel, and install it with target fd.=0A=