linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Toralf Förster" <toralf.foerster@gmx.de>
To: Trond Myklebust <trondmy@gmail.com>
Cc: linux-nfs@vger.kernel.org
Subject: Re: [PATCH] fs/nfs/idmap.c: fix a Memory leak for variable desc
Date: Sun, 27 Apr 2014 10:34:04 +0200	[thread overview]
Message-ID: <535CC0FC.8070403@gmx.de> (raw)
In-Reply-To: <CAABAsM5nm9eRJXF809TPLu5qNeVU0XLPPjtfnji37REQmYHqsQ@mail.gmail.com>

On 04/27/2014 02:10 AM, Trond Myklebust wrote:
> On Sat, Apr 26, 2014 at 3:55 PM, Toralf Förster <toralf.foerster@gmx.de> wrote:
>> Signed-off-by: Toralf Förster <toralf.foerster@gmx.de>
>> ---
>>  fs/nfs/idmap.c | 4 +++-
>>  1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/fs/nfs/idmap.c b/fs/nfs/idmap.c
>> index 567983d..8eb4954 100644
>> --- a/fs/nfs/idmap.c
>> +++ b/fs/nfs/idmap.c
>> @@ -272,8 +272,10 @@ static struct key *nfs_idmap_request_key(const char *name, size_t namelen,
>>         ssize_t ret;
>>
>>         ret = nfs_idmap_get_desc(name, namelen, type, strlen(type), &desc);
>> -       if (ret <= 0)
>> +       if (ret <= 0) {
>> +               kfree(desc);
>>                 return ERR_PTR(ret);
>> +       }
>>
>>         rkey = request_key(&key_type_id_resolver, desc, "");
>>         if (IS_ERR(rkey)) {
> 
> Hi Toralf,
> 
> As far as I can tell, the only error that nfs_idmap_get_desc() can
> return is ret==-ENOMEM, in which case desc==NULL.
> It cannot ever return ret==0, either, since the return value,
> 'desclen', has a lower bound of '2'.                                   <-----------------

Ick, that I was missing - sry for the noise.

> Cheers
>   Trond
> 


-- 
Toralf


      reply	other threads:[~2014-04-27  8:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-26 19:55 [PATCH] fs/nfs/idmap.c: fix a Memory leak for variable desc Toralf Förster
2014-04-27  0:10 ` Trond Myklebust
2014-04-27  8:34   ` Toralf Förster [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=535CC0FC.8070403@gmx.de \
    --to=toralf.foerster@gmx.de \
    --cc=linux-nfs@vger.kernel.org \
    --cc=trondmy@gmail.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).