summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2024-06-02 18:15:25 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-06-16 13:28:48 +0200
commit6ed45d20d30005bed94c8c527ce51d5ad8121018 (patch)
treef5f415f4dcea13597e8109d50adcc6f007b066a5
parentf5f4675960609d8c5ee95f027fbf6ce380f98372 (diff)
downloadlinux-6ed45d20d30005bed94c8c527ce51d5ad8121018.tar.gz
linux-6ed45d20d30005bed94c8c527ce51d5ad8121018.tar.bz2
linux-6ed45d20d30005bed94c8c527ce51d5ad8121018.zip
SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
commit 4a77c3dead97339478c7422eb07bf4bf63577008 upstream. The in_token->pages[] array is not NULL terminated. This results in the following KASAN splat: KASAN: maybe wild-memory-access in range [0x04a2013400000008-0x04a201340000000f] Fixes: bafa6b4d95d9 ("SUNRPC: Fix gss_free_in_token_pages()") Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 053c65da04bc..f583a325a925 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1104,7 +1104,7 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,
}
pages = DIV_ROUND_UP(inlen, PAGE_SIZE);
- in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL);
+ in_token->pages = kcalloc(pages + 1, sizeof(struct page *), GFP_KERNEL);
if (!in_token->pages) {
kfree(in_handle->data);
return SVC_DENIED;