public inbox for linux-nfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] SUNRPC: Check if we need to recalculate slack estimates
@ 2025-11-19 13:32 Scott Mayhew
  2025-11-19 15:48 ` Chuck Lever
  0 siblings, 1 reply; 6+ messages in thread
From: Scott Mayhew @ 2025-11-19 13:32 UTC (permalink / raw)
  To: trondmy, anna; +Cc: linux-nfs

If the incoming GSS verifier is larger than what we previously recorded
on the gss_auth, that would indicate the GSS cred/context used for that
RPC is using a different enctype than the one used by the machine
cred/context, and we should recalculate the slack variables accordingly.

Link: https://bugs.debian.org/1120598
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
 net/sunrpc/auth_gss/auth_gss.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/net/sunrpc/auth_gss/auth_gss.c b/net/sunrpc/auth_gss/auth_gss.c
index 5c095cb8cb20..6da9ca08370d 100644
--- a/net/sunrpc/auth_gss/auth_gss.c
+++ b/net/sunrpc/auth_gss/auth_gss.c
@@ -1721,6 +1721,14 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)
 	if (maj_stat)
 		goto bad_mic;
 
+	/*
+	 * Normally we only recalculate the slack variables once after
+	 * creating a new gss_auth, but we should also do it if the incoming
+	 * verifier has a larger size than what was previously recorded.
+	 */
+	if (cred->cr_auth->au_verfsize < (XDR_QUADLEN(len) + 2))
+		__set_bit(RPCAUTH_AUTH_UPDATE_SLACK, &cred->cr_auth->au_flags);
+
 	/* We leave it to unwrap to calculate au_rslack. For now we just
 	 * calculate the length of the verifier: */
 	if (test_bit(RPCAUTH_AUTH_UPDATE_SLACK, &cred->cr_auth->au_flags))
-- 
2.51.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-02-14 17:50 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-19 13:32 [PATCH] SUNRPC: Check if we need to recalculate slack estimates Scott Mayhew
2025-11-19 15:48 ` Chuck Lever
2026-01-02 12:34   ` Salvatore Bonaccorso
2026-01-02 14:49     ` Chuck Lever
2026-02-13 22:45     ` Scott Mayhew
2026-02-14 15:57       ` Salvatore Bonaccorso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox