Commit da522b5f authored by Chuck Lever's avatar Chuck Lever Committed by Chuck Lever

SUNRPC: Don't leak netobj memory when gss_read_proxy_verf() fails

Fixes: 030d794b ("SUNRPC: Use gssproxy upcall for server RPCGSS authentication.")
Signed-off-by: default avatarChuck Lever <chuck.lever@oracle.com>
Cc: <stable@vger.kernel.org>
Reviewed-by: default avatarJeff Layton <jlayton@kernel.org>
parent 638593be
......@@ -1162,18 +1162,23 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,
return res;
inlen = svc_getnl(argv);
if (inlen > (argv->iov_len + rqstp->rq_arg.page_len))
if (inlen > (argv->iov_len + rqstp->rq_arg.page_len)) {
kfree(in_handle->data);
return SVC_DENIED;
}
pages = DIV_ROUND_UP(inlen, PAGE_SIZE);
in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL);
if (!in_token->pages)
if (!in_token->pages) {
kfree(in_handle->data);
return SVC_DENIED;
}
in_token->page_base = 0;
in_token->page_len = inlen;
for (i = 0; i < pages; i++) {
in_token->pages[i] = alloc_page(GFP_KERNEL);
if (!in_token->pages[i]) {
kfree(in_handle->data);
gss_free_in_token_pages(in_token);
return SVC_DENIED;
}
......
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