linux/net/sunrpc/auth_gss
Chuck Lever bafa6b4d95 SUNRPC: Fix gss_free_in_token_pages()
Dan Carpenter says:
> Commit 5866efa8cb ("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: 5866efa8cb ("SUNRPC: Fix svcauth_gss_proxy_init()")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2024-05-09 09:10:10 -04:00
..
auth_gss_internal.h SUNRPC/auth_gss: Convert GFP_NOFS to GFP_KERNEL 2022-02-25 18:50:12 -05:00
auth_gss.c net: fill in MODULE_DESCRIPTION()s for Sun RPC 2024-01-11 16:16:08 -08:00
gss_generic_token.c sunrpc: Remove unneeded null check 2022-01-06 14:00:20 -05:00
gss_krb5_crypto.c SUNRPC: Revert 561141dd49 2024-03-22 09:52:00 -04:00
gss_krb5_internal.h SUNRPC: Remove net/sunrpc/auth_gss/gss_krb5_seqnum.c 2023-08-29 17:45:22 -04:00
gss_krb5_keys.c SUNRPC: Remove krb5_derive_key_v1() 2023-08-29 17:45:22 -04:00
gss_krb5_mech.c SUNRPC: fix a memleak in gss_import_v2_context 2024-03-01 09:12:04 -05:00
gss_krb5_seal.c SUNRPC: Remove code behind CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED 2023-08-29 17:45:22 -04:00
gss_krb5_test.c SUNRPC: Remove Kunit tests for the DES3 encryption type 2023-08-29 17:45:22 -04:00
gss_krb5_unseal.c SUNRPC: Do not include crypto/algapi.h 2023-09-15 18:30:43 +08:00
gss_krb5_wrap.c SUNRPC: Remove code behind CONFIG_RPCSEC_GSS_KRB5_SIMPLIFIED 2023-08-29 17:45:22 -04:00
gss_mech_switch.c sunrpc: clean up properly in gss_mech_unregister() 2020-05-28 18:15:00 -04:00
gss_rpc_upcall.c SUNRPC: Ensure that the gssproxy client can start in a connected state 2022-05-07 14:31:15 -04:00
gss_rpc_upcall.h SUNRPC: Add SPDX IDs to some net/sunrpc/auth_gss/ files 2019-02-14 09:54:37 -05:00
gss_rpc_xdr.c SUNRPC: fix some memleaks in gssx_dec_option_array 2024-03-01 09:12:04 -05:00
gss_rpc_xdr.h SUNRPC: Add SPDX IDs to some net/sunrpc/auth_gss/ files 2019-02-14 09:54:37 -05:00
Makefile SUNRPC: Remove net/sunrpc/auth_gss/gss_krb5_seqnum.c 2023-08-29 17:45:22 -04:00
svcauth_gss.c SUNRPC: Fix gss_free_in_token_pages() 2024-05-09 09:10:10 -04:00
trace.c SUNRPC: remove duplicate include 2020-08-19 13:19:42 -04:00