2016-10-04 04:07:47

by Trond Myklebust

[permalink] [raw]
Subject: [PATCH] NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic

From: Jeff Layton <[email protected]>

The caller of rpc_run_task also gets a reference that must be put.

Signed-off-by: Jeff Layton <[email protected]>
Cc: [email protected] # 4.2+
Signed-off-by: Trond Myklebust <[email protected]>
---
fs/nfs/nfs42proc.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
index 64b43b4ad9dd..608501971fe0 100644
--- a/fs/nfs/nfs42proc.c
+++ b/fs/nfs/nfs42proc.c
@@ -443,6 +443,7 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *server,
task = rpc_run_task(&task_setup);
if (IS_ERR(task))
return PTR_ERR(task);
+ rpc_put_task(task);
return 0;
}

--
2.7.4



2016-10-04 10:43:50

by Jeff Layton

[permalink] [raw]
Subject: Re: [PATCH] NFSv4.2: Fix a reference leak in nfs42_proc_layoutstats_generic

On Tue, 2016-10-04 at 00:07 -0400, Trond Myklebust wrote:
> From: Jeff Layton <[email protected]>
>
> The caller of rpc_run_task also gets a reference that must be put.
>
> Signed-off-by: Jeff Layton <[email protected]>
> Cc: [email protected] # 4.2+
> Signed-off-by: Trond Myklebust <[email protected]>
> ---
> fs/nfs/nfs42proc.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/nfs/nfs42proc.c b/fs/nfs/nfs42proc.c
> index 64b43b4ad9dd..608501971fe0 100644
> --- a/fs/nfs/nfs42proc.c
> +++ b/fs/nfs/nfs42proc.c
> @@ -443,6 +443,7 @@ int nfs42_proc_layoutstats_generic(struct nfs_server *server,
> task = rpc_run_task(&task_setup);
> if (IS_ERR(task))
> return PTR_ERR(task);
> + rpc_put_task(task);
> return 0;
> }
>

Ouch, good catch. I thought I had sent this upstream long ago, but I
guess it slipped through the cracks.

Thanks,
--
Jeff Layton <[email protected]>