SUNRPC: Fix a potential memory leak in auth_gss
authorTrond Myklebust <Trond.Myklebust@netapp.com>
Fri, 19 Mar 2010 19:36:22 +0000 (15:36 -0400)
committerTrond Myklebust <Trond.Myklebust@netapp.com>
Sun, 21 Mar 2010 16:22:49 +0000 (12:22 -0400)
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>
Acked-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: stable@kernel.org
net/sunrpc/auth_gss/auth_gss.c

index 0cfccc2..c389ccf 100644 (file)
@@ -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;
 }