All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Fix a potential memory leak in auth_gss
@ 2010-03-19 19:27 Trond Myklebust
       [not found] ` <1269026879.10771.2.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
  0 siblings, 1 reply; 2+ messages in thread
From: Trond Myklebust @ 2010-03-19 19:27 UTC (permalink / raw)
  To: linux-nfs; +Cc: Dr. J. Bruce Fields

From: Trond Myklebust <Trond.Myklebust@netapp.com>

The function alloc_enc_pages() currently fails to release the pointer
rqstp->rq_enc_pages in the error path.

Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
---

 net/sunrpc/auth_gss/auth_gss.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)


diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 0cfccc2..c389ccf 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1280,9 +1280,8 @@ alloc_enc_pages(struct rpc_rqst *rqstp)
 	rqstp->rq_release_snd_buf = priv_release_snd_buf;
 	return 0;
 out_free:
-	for (i--; i >= 0; i--) {
-		__free_page(rqstp->rq_enc_pages[i]);
-	}
+	rqstp->rq_enc_pages_num = i;
+	priv_release_snd_buf(rqstp);
 out:
 	return -EAGAIN;
 }


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] SUNRPC: Fix a potential memory leak in auth_gss
       [not found] ` <1269026879.10771.2.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
@ 2010-03-21  1:45   ` Dr. J. Bruce Fields
  0 siblings, 0 replies; 2+ messages in thread
From: Dr. J. Bruce Fields @ 2010-03-21  1:45 UTC (permalink / raw)
  To: Trond Myklebust; +Cc: linux-nfs

On Fri, Mar 19, 2010 at 03:27:59PM -0400, Trond Myklebust wrote:
> From: Trond Myklebust <Trond.Myklebust@netapp.com>
> 
> The function alloc_enc_pages() currently fails to release the pointer
> rqstp->rq_enc_pages in the error path.

Thanks, and it's simpler, too.  For what it's worth:

	Acked-by: J. Bruce Fields <bfields@citi.umich.edu>

--b.

> 
> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
> ---
> 
>  net/sunrpc/auth_gss/auth_gss.c |    5 ++---
>  1 files changed, 2 insertions(+), 3 deletions(-)
> 
> 
> diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
> index 0cfccc2..c389ccf 100644
> --- a/net/sunrpc/auth_gss/auth_gss.c
> +++ b/net/sunrpc/auth_gss/auth_gss.c
> @@ -1280,9 +1280,8 @@ alloc_enc_pages(struct rpc_rqst *rqstp)
>  	rqstp->rq_release_snd_buf = priv_release_snd_buf;
>  	return 0;
>  out_free:
> -	for (i--; i >= 0; i--) {
> -		__free_page(rqstp->rq_enc_pages[i]);
> -	}
> +	rqstp->rq_enc_pages_num = i;
> +	priv_release_snd_buf(rqstp);
>  out:
>  	return -EAGAIN;
>  }
> 

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-03-21  1:43 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-19 19:27 [PATCH] SUNRPC: Fix a potential memory leak in auth_gss Trond Myklebust
     [not found] ` <1269026879.10771.2.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/Bob@public.gmane.org>
2010-03-21  1:45   ` Dr. J. Bruce Fields

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.