linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Schumaker, Anna" <Anna.Schumaker@netapp.com>
To: "navid.emamdoost@gmail.com" <navid.emamdoost@gmail.com>,
	"trond.myklebust@hammerspace.com"
	<trond.myklebust@hammerspace.com>
Cc: "linux-nfs@vger.kernel.org" <linux-nfs@vger.kernel.org>,
	"emamd001@umn.edu" <emamd001@umn.edu>,
	"smccaman@umn.edu" <smccaman@umn.edu>,
	"kjlu@umn.edu" <kjlu@umn.edu>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] NFSv4: fix memory leak if nfs4_begin_drain_session fails
Date: Tue, 12 Nov 2019 18:47:01 +0000	[thread overview]
Message-ID: <d7531388512379288c5719f152fc5ae5ecd8509a.camel@netapp.com> (raw)
In-Reply-To: <CAEkB2EQ2BPpXcpRpN-+ErJD5Vkq6LiKONy8XQfvu0F1pO4weqw@mail.gmail.com>

Hi Navid,

On Tue, 2019-11-05 at 23:37 -0600, Navid Emamdoost wrote:
> Would you please review this patch?

This memory leak was fixed by:

commit 1e672e3644940d83bd94e7cb46bac6bb3627de02
Author: Wenwen Wang <wenwen@cs.uga.edu>
Date:   Tue Aug 20 22:21:21 2019 -0500

    NFSv4: Fix a memory leak bug
    
    In nfs4_try_migration(), if nfs4_begin_drain_session() fails, the
    previously allocated 'page' and 'locations' are not deallocated, leading to
    memory leaks. To fix this issue, go to the 'out' label to free 'page' and
    'locations' before returning the error.
    
    Signed-off-by: Wenwen Wang <wenwen@cs.uga.edu>
    Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>



And was included as part of the initial NFS merge for the v5.4-rc cycle.

Thanks,
Anna

> 
> On Thu, Sep 19, 2019 at 7:22 PM Navid Emamdoost
> <navid.emamdoost@gmail.com> wrote:
> > In nfs4_try_migration, if nfs4_begin_drain_session fails the allocated
> > memory should be released.
> > 
> > Signed-off-by: Navid Emamdoost <navid.emamdoost@gmail.com>
> > ---
> >  fs/nfs/nfs4state.c | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/fs/nfs/nfs4state.c b/fs/nfs/nfs4state.c
> > index cad4e064b328..124649f12067 100644
> > --- a/fs/nfs/nfs4state.c
> > +++ b/fs/nfs/nfs4state.c
> > @@ -2096,7 +2096,7 @@ static int nfs4_try_migration(struct nfs_server
> > *server, const struct cred *cred
> > 
> >         status = nfs4_begin_drain_session(clp);
> >         if (status != 0)
> > -               return status;
> > +               goto out;
> > 
> >         status = nfs4_replace_transport(server, locations);
> >         if (status != 0) {
> > --
> > 2.17.1
> > 
> 
> --
> Navid.

      reply	other threads:[~2019-11-12 18:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-20  0:22 [PATCH] NFSv4: fix memory leak if nfs4_begin_drain_session fails Navid Emamdoost
2019-11-06  5:37 ` Navid Emamdoost
2019-11-12 18:47   ` Schumaker, Anna [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d7531388512379288c5719f152fc5ae5ecd8509a.camel@netapp.com \
    --to=anna.schumaker@netapp.com \
    --cc=emamd001@umn.edu \
    --cc=kjlu@umn.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-nfs@vger.kernel.org \
    --cc=navid.emamdoost@gmail.com \
    --cc=smccaman@umn.edu \
    --cc=trond.myklebust@hammerspace.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).