Skip to contentSkip to conversation

SUNRPC: Fix a potential memory leak in auth_gss

PATCH In review Trond Myklebust 2 participants 2 messages Mar 19, 2010 – Mar 21, 2010 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 SUNRPC: Fix a potential memory leak in auth_gss

From: Trond Myklebust <[email protected]>

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

---

 net/sunrpc/auth_gss/auth_gss.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +2 -3
index 0cfccc2..c389ccf 100644
@@ -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;
 }

A message that is not in the archive (sent off-list or not yet received): 1269026879.10771.2.camel-bi+AKbBUZKY6gyzm1THtWbp2dZbC/[email protected]

Acked-by J. Bruce Fields
#2 lore raw
Quoted 4 lines · Trond Myklebust

From: Trond Myklebust <[email protected]>

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:

--b.

Quoted 25 lines

---

 net/sunrpc/auth_gss/auth_gss.c |    5 ++---
 1 files changed, 2 insertions(+), 3 deletions(-)
net/sunrpc/auth_gss/auth_gss.c +2 -3
index 0cfccc2..c389ccf 100644
@@ -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;
 }