linux/net/sunrpc
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 SUNRPC: Fix gss_free_in_token_pages() 2024-05-09 09:10:10 -04:00
xprtrdma Revert "svcrdma: Add Write chunk WRs to the RPC's Send WR chain" 2024-04-20 11:20:41 -04:00
.kunitconfig SUNRPC: Remove RPCSEC_GSS_KRB5_ENCTYPES_DES 2023-08-29 17:45:22 -04:00
addr.c net: sunrpc: Fix an off by one in rpc_sockaddr2uaddr() 2024-02-28 16:18:18 -05:00
auth_null.c SUNRPC: Add rpc_auth::au_ralign field 2019-02-14 11:48:36 -05:00
auth_tls.c SUNRPC: Fail quickly when server does not recognize TLS 2023-09-27 15:16:40 -04:00
auth_unix.c SUNRPC: Fix unx_lookup_cred() allocation 2022-03-22 15:52:55 -04:00
auth.c cred: get rid of CONFIG_DEBUG_CREDENTIALS 2023-12-15 14:19:48 -08:00
backchannel_rqst.c SUNRPC: change the back-channel queue to lwq 2023-10-16 12:44:08 -04:00
cache.c treewide: use get_random_u32_below() instead of deprecated function 2022-11-18 02:15:15 +01:00
clnt.c sunrpc: add a struct rpc_stats arg to rpc_create_args 2024-03-09 09:14:50 -05:00
debugfs.c SUNRPC: Cache deferral injection 2022-05-19 12:25:38 -04:00
fail.h SUNRPC: Cache deferral injection 2022-05-19 12:25:38 -04:00
Kconfig SUNRPC: Remove CONFIG_RPCSEC_GSS_KRB5_CRYPTOSYSTEM 2023-08-29 17:45:22 -04:00
Makefile SUNRPC: Add RPC client support for the RPC_AUTH_TLS auth flavor 2023-06-19 12:18:36 -04:00
netns.h SUNRPC: Fix occasional warning when destroying gss_krb5_enctypes 2023-02-20 09:20:57 -05:00
rpc_pipe.c mm, slab: remove last vestiges of SLAB_MEM_SPREAD 2024-03-12 20:32:19 -07:00
rpcb_clnt.c SUNRPC: Add an IS_ERR() check back to where it was 2023-11-01 15:40:44 -04:00
sched.c SUNRPC: Don't change task->tk_status after the call to rpc_exit_task 2023-05-19 16:50:05 -04:00
socklib.c use less confusing names for iov_iter direction initializers 2022-11-25 13:01:55 -05:00
socklib.h SUNRPC: Refactor xs_sendpages() 2020-03-16 12:04:33 -04:00
stats.c sunrpc: use the struct net as the svc proc private 2024-03-01 09:12:09 -05:00
sunrpc_syms.c net: fill in MODULE_DESCRIPTION()s for Sun RPC 2024-01-11 16:16:08 -08:00
sunrpc.h treewide: Replace GPLv2 boilerplate/reference with SPDX - gpl-2.0_149.RULE 2022-06-10 14:51:35 +02:00
svc_xprt.c SUNRPC: Remove comment for sp_lock 2024-05-06 09:07:23 -04:00
svc.c sunrpc: removed redundant procp check 2024-05-06 09:07:18 -04:00
svcauth_unix.c SUNRPC: Add enum svc_auth_status 2023-08-29 17:45:22 -04:00
svcauth.c SUNRPC: Add a server-side API for retrieving an RPC's pseudoflavor 2024-01-07 17:54:25 -05:00
svcsock.c SUNRPC: Fix a slow server-side memory leak with RPC-over-TCP 2024-04-04 09:43:02 -04:00
sysctl.c sunrpc: simplify one-level sysctl registration for debug_table 2023-04-11 12:45:19 -04:00
sysfs.c SUNRPC: Add a TCP-with-TLS RPC transport class 2023-06-19 12:28:10 -04:00
sysfs.h NFS: Add sysfs links to sunrpc clients for nfs_clients 2023-06-19 15:04:13 -04:00
timer.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
xdr.c NFS CLient Updates for Linux 6.6 2023-08-31 15:36:41 -07:00
xprt.c SUNRPC: Add a transport callback to handle dequeuing of an RPC request 2024-02-28 15:00:14 -05:00
xprtmultipath.c SUNRPC: fix _xprt_switch_find_current_entry logic 2024-01-04 10:47:56 -05:00
xprtsock.c NFS client bugfixes for Linux 6.9 2024-04-29 12:07:37 -07:00