Re: [PATCH] fs/nfs/idmap.c: fix a Memory leak for variable desc

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Apr 26, 2014 at 3:55 PM, Toralf Förster <toralf.foerster@xxxxxx> wrote:
> Signed-off-by: Toralf Förster <toralf.foerster@xxxxxx>
> ---
>  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'. What am I missing?

Cheers
  Trond
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Filesystem Development]     [Linux USB Development]     [Linux Media Development]     [Video for Linux]     [Linux NILFS]     [Linux Audio Users]     [Yosemite Info]     [Linux SCSI]

  Powered by Linux