Patch "SUNRPC: Fix gss_free_in_token_pages()" has been added to the 6.9-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    SUNRPC: Fix gss_free_in_token_pages()

to the 6.9-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     sunrpc-fix-gss_free_in_token_pages.patch
and it can be found in the queue-6.9 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit c561483e3706fef93c06f015eaf31f25d450aca9
Author: Chuck Lever <chuck.lever@xxxxxxxxxx>
Date:   Tue May 7 09:10:41 2024 -0400

    SUNRPC: Fix gss_free_in_token_pages()
    
    [ Upstream commit bafa6b4d95d97877baa61883ff90f7e374427fae ]
    
    Dan Carpenter says:
    > Commit 5866efa8cbfb ("SUNRPC: Fix svcauth_gss_proxy_init()") from Oct
    > 24, 2019 (linux-next), leads to the following Smatch static checker
    > warning:
    >
    >       net/sunrpc/auth_gss/svcauth_gss.c:1039 gss_free_in_token_pages()
    >       warn: iterator 'i' not incremented
    >
    > net/sunrpc/auth_gss/svcauth_gss.c
    >     1034 static void gss_free_in_token_pages(struct gssp_in_token *in_token)
    >     1035 {
    >     1036         u32 inlen;
    >     1037         int i;
    >     1038
    > --> 1039         i = 0;
    >     1040         inlen = in_token->page_len;
    >     1041         while (inlen) {
    >     1042                 if (in_token->pages[i])
    >     1043                         put_page(in_token->pages[i]);
    >                                                          ^
    > This puts page zero over and over.
    >
    >     1044                 inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen;
    >     1045         }
    >     1046
    >     1047         kfree(in_token->pages);
    >     1048         in_token->pages = NULL;
    >     1049 }
    
    Based on the way that the ->pages[] array is constructed in
    gss_read_proxy_verf(), we know that once the loop encounters a NULL
    page pointer, the remaining array elements must also be NULL.
    
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Suggested-by: Trond Myklebust <trondmy@xxxxxxxxxxxxxxx>
    Fixes: 5866efa8cbfb ("SUNRPC: Fix svcauth_gss_proxy_init()")
    Signed-off-by: Chuck Lever <chuck.lever@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index 24de941847003..96ab50eda9c2e 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1033,17 +1033,11 @@ svcauth_gss_proc_init_verf(struct cache_detail *cd, struct svc_rqst *rqstp,
 
 static void gss_free_in_token_pages(struct gssp_in_token *in_token)
 {
-	u32 inlen;
 	int i;
 
 	i = 0;
-	inlen = in_token->page_len;
-	while (inlen) {
-		if (in_token->pages[i])
-			put_page(in_token->pages[i]);
-		inlen -= inlen > PAGE_SIZE ? PAGE_SIZE : inlen;
-	}
-
+	while (in_token->pages[i])
+		put_page(in_token->pages[i++]);
 	kfree(in_token->pages);
 	in_token->pages = NULL;
 }




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux