kernel_samsung_a53x/net/sunrpc/auth_gss
Chuck Lever e83140c9c8 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@linaro.org>
Suggested-by: Trond Myklebust <trondmy@hammerspace.com>
Fixes: 5866efa8cbfb ("SUNRPC: Fix svcauth_gss_proxy_init()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-19 12:26:59 +01:00
..
auth_gss.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
auth_gss_internal.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_generic_token.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_crypto.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_keys.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_mech.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_seal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_seqnum.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_unseal.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_krb5_wrap.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_mech_switch.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_rpc_upcall.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_rpc_upcall.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
gss_rpc_xdr.c SUNRPC: fix some memleaks in gssx_dec_option_array 2024-11-19 08:44:47 +01:00
gss_rpc_xdr.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
svcauth_gss.c SUNRPC: Fix gss_free_in_token_pages() 2024-11-19 12:26:59 +01:00
trace.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00