Skip to content

Commit 4a77c3d

Browse files
committed
SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
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: bafa6b4 ("SUNRPC: Fix gss_free_in_token_pages()") Reviewed-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
1 parent 8d915bb commit 4a77c3d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/sunrpc/auth_gss/svcauth_gss.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,7 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,
10691069
goto out_denied_free;
10701070

10711071
pages = DIV_ROUND_UP(inlen, PAGE_SIZE);
1072-
in_token->pages = kcalloc(pages, sizeof(struct page *), GFP_KERNEL);
1072+
in_token->pages = kcalloc(pages + 1, sizeof(struct page *), GFP_KERNEL);
10731073
if (!in_token->pages)
10741074
goto out_denied_free;
10751075
in_token->page_base = 0;

0 commit comments

Comments
 (0)