]> Git Repo - linux.git/commitdiff
SUNRPC: Fix loop termination condition in gss_free_in_token_pages()
authorChuck Lever <[email protected]>
Sun, 2 Jun 2024 22:15:25 +0000 (18:15 -0400)
committerChuck Lever <[email protected]>
Mon, 3 Jun 2024 13:07:55 +0000 (09:07 -0400)
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 <[email protected]>
Signed-off-by: Chuck Lever <[email protected]>
net/sunrpc/auth_gss/svcauth_gss.c

index 96ab50eda9c2eb66b40fb376662aab21a861e9e5..73a90ad873fb9da659ba76184b2e2a0e5324ce0d 100644 (file)
@@ -1069,7 +1069,7 @@ static int gss_read_proxy_verf(struct svc_rqst *rqstp,
                goto out_denied_free;
 
        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)
                goto out_denied_free;
        in_token->page_base = 0;
This page took 0.063777 seconds and 4 git commands to generate.