From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <pboldin@mirantis.com>
Received: from mail-wi0-f176.google.com (mail-wi0-f176.google.com
 [209.85.212.176]) by dpdk.org (Postfix) with ESMTP id 4C254683D
 for <dev@dpdk.org>; Tue, 24 Mar 2015 12:10:47 +0100 (CET)
Received: by wibgn9 with SMTP id gn9so92184482wib.1
 for <dev@dpdk.org>; Tue, 24 Mar 2015 04:10:47 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mirantis.com; s=google;
 h=mime-version:in-reply-to:references:date:message-id:subject:from:to
 :cc:content-type;
 bh=mMhu5yvCPSi7aESORvgXTgRDujmaJZnPLfSMSeJxNMU=;
 b=jkTyT4oZ5I9Od6AXF8Sk/uA6zzgKZ8HPHP7rYTKse9GZn95T0yKw6TLFJZmH5M2stb
 fdOD5brW5i6X9/TKfIE3LGiZs/JxMvi6FCUHWaxoINh7rsJpxj0sDX0If/gELKXTSwLG
 00OeKUqHkC5l07J3/BciqRsbuzR+s8jMARXr8=
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20130820;
 h=x-gm-message-state:mime-version:in-reply-to:references:date
 :message-id:subject:from:to:cc:content-type;
 bh=mMhu5yvCPSi7aESORvgXTgRDujmaJZnPLfSMSeJxNMU=;
 b=fj0hlNERtaXIzZdWN3xcDlYNNAVxzmrCLzK6TSg1KVglJIn2coa/rEkyety/v29Yub
 8ERzVescqM84EJdD9/BWZMWdDq/kT0vU72O/r4EWl1BKAs3lNTtcSE+z7xXUg4MiDxf9
 VSk6pEPk51ujKqJT4Wiytr+3DG1f4LKoKx5+Xuw7KWWIKMeJKceeKLUBMHEC4wuzcI/9
 7TwTTxKbGy+PCoJOq6rU3ORz1j2Wx8y+G6Soi0+FnEQOsB/GeyaDt6NBifhGRc5+r0oX
 4acwjpEwagT9B3wPfAXLUBx96H/D3YZX757cs8dLjNz5p8kX9yhKoQ42yQQfpkoi3C90
 /jMA==
X-Gm-Message-State: ALoCoQmKBsyJTRvl2lk5XoxRT0Nw1bvYspdpKfdiNAnjlU8PJ+Dgv4sVxpGF8iqeGwhCXx+ypTw1
MIME-Version: 1.0
X-Received: by 10.180.80.7 with SMTP id n7mr27387135wix.60.1427195447104; Tue,
 24 Mar 2015 04:10:47 -0700 (PDT)
Received: by 10.194.76.7 with HTTP; Tue, 24 Mar 2015 04:10:47 -0700 (PDT)
In-Reply-To: <C37D651A908B024F974696C65296B57B0F3F46FB@SHSMSX101.ccr.corp.intel.com>
References: <1427115225-14489-1-git-send-email-pboldin@mirantis.com>
 <C37D651A908B024F974696C65296B57B0F3F46FB@SHSMSX101.ccr.corp.intel.com>
Date: Tue, 24 Mar 2015 13:10:47 +0200
Message-ID: <CACf4_B-x4yOwoksvOoDxipgahayNWdtQi-caNGtCL7ZxAMh-qg@mail.gmail.com>
From: Pavel Boldin <pboldin@mirantis.com>
To: "Xie, Huawei" <huawei.xie@intel.com>
Content-Type: text/plain; charset=UTF-8
X-Content-Filtered-By: Mailman/MimeDel 2.1.15
Cc: "dev@dpdk.org" <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 <dev.dpdk.org>
List-Unsubscribe: <http://dpdk.org/ml/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://dpdk.org/ml/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <http://dpdk.org/ml/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Tue, 24 Mar 2015 11:10:47 -0000

On Tue, Mar 24, 2015 at 8:28 AM, Xie, Huawei <huawei.xie@intel.com> 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 <pboldin@mirantis.com>
> > ---
> >  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_vhost/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 = files_fdtable(files);
> >               fdt->fd[eventfd_copy.source_fd] = NULL;
> Acked-by Huawei Xie <huawei.xie@intel.com>
>
> 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