Commit 8dae5398 authored by Chuck Lever's avatar Chuck Lever Committed by Trond Myklebust

SUNRPC: Fix leak of krb5p encode pages

call_encode can be invoked more than once per RPC call. Ensure that
each call to gss_wrap_req_priv does not overwrite pointers to
previously allocated memory.
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Cc: stable@kernel.org
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@hammerspace.com>
parent 9bd11523
...@@ -1791,6 +1791,7 @@ priv_release_snd_buf(struct rpc_rqst *rqstp) ...@@ -1791,6 +1791,7 @@ priv_release_snd_buf(struct rpc_rqst *rqstp)
for (i=0; i < rqstp->rq_enc_pages_num; i++) for (i=0; i < rqstp->rq_enc_pages_num; i++)
__free_page(rqstp->rq_enc_pages[i]); __free_page(rqstp->rq_enc_pages[i]);
kfree(rqstp->rq_enc_pages); kfree(rqstp->rq_enc_pages);
rqstp->rq_release_snd_buf = NULL;
} }
static int static int
...@@ -1799,6 +1800,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp) ...@@ -1799,6 +1800,9 @@ alloc_enc_pages(struct rpc_rqst *rqstp)
struct xdr_buf *snd_buf = &rqstp->rq_snd_buf; struct xdr_buf *snd_buf = &rqstp->rq_snd_buf;
int first, last, i; int first, last, i;
if (rqstp->rq_release_snd_buf)
rqstp->rq_release_snd_buf(rqstp);
if (snd_buf->page_len == 0) { if (snd_buf->page_len == 0) {
rqstp->rq_enc_pages_num = 0; rqstp->rq_enc_pages_num = 0;
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment