Skip to contentSkip to conversation

sunrpc: fix loop in gss seqno cache

PATCH In review Nikhil Jha 3 participants 3 messages Jun 11, 2025 – Jun 13, 2025

Subsystems (3)
lore
Share & tools
lore

Nikhil Jha

author
#0 lore raw

PATCH 1/1 sunrpc: fix loop in gss seqno cache

There was a silly bug in the initial implementation where a loop variable was not incremented. This commit increments the loop variable.

This bug is somewhat tricky to catch because it can only happen on loops of two or more. If it is hit, it locks up a kernel thread in an infinite loop.

---
 net/sunrpc/auth_gss/auth_gss.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/sunrpc/auth_gss/auth_gss.c +1 -1
index 0fa244f16876f3c434fd507b4d53c5eefd748ce4..7b943fbafcc38ba79a685589d696017e8cdc694a 100644
@@ -1724,7 +1724,7 @@ gss_validate(struct rpc_task *task, struct xdr_stream *xdr)
 	maj_stat = gss_validate_seqno_mic(ctx, task->tk_rqstp->rq_seqnos[0], seq, p, len);
 	/* RFC 2203 5.3.3.1 - compute the checksum of each sequence number in the cache */
 	while (unlikely(maj_stat == GSS_S_BAD_SIG && i < task->tk_rqstp->rq_seqno_count))
-		maj_stat = gss_validate_seqno_mic(ctx, task->tk_rqstp->rq_seqnos[i], seq, p, len);
+		maj_stat = gss_validate_seqno_mic(ctx, task->tk_rqstp->rq_seqnos[i++], seq, p, len);
 	if (maj_stat == GSS_S_CONTEXT_EXPIRED)
 		clear_bit(RPCAUTH_CRED_UPTODATE, &cred->cr_flags);
 	if (maj_stat)

---
base-commit: 488ef3560196ee10fc1c5547e1574a87068c3494
change-id: 20250611-fix-loop-in-seqno-cache-6cf71c4ae9ea

Best regards,

Signature · 1 line
Nikhil Jha <[email protected]>
Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · On 11 Jun 2025, at 15:46, Nikhil Jha via B4 Relay wrote:

From: Nikhil Jha <[email protected]>

There was a silly bug in the initial implementation where a loop variable was not incremented. This commit increments the loop variable.

This bug is somewhat tricky to catch because it can only happen on loops of two or more. If it is hit, it locks up a kernel thread in an infinite loop.

Fixes 08d6ee6d8a10 ("sunrpc: implement rfc2203 rpcsec_gss seqnum cache")

Ben

#2 lore raw
Quoted 11 lines · Benjamin Coddington
Quoted 9 lines · On 11 Jun 2025, at 15:46, Nikhil Jha via B4 Relay wrote:

From: Nikhil Jha <[email protected]>

There was a silly bug in the initial implementation where a loop variable was not incremented. This commit increments the loop variable.

This bug is somewhat tricky to catch because it can only happen on loops of two or more. If it is hit, it locks up a kernel thread in an infinite loop.

Quoted 5 lines
Quoted 2 lines
Fixes 08d6ee6d8a10 ("sunrpc: implement rfc2203 rpcsec_gss seqnum cache")

Thanks! I've applied this bugfix to my linux-next, and I'll send a pull request with it before v6.16-final.

Anna>

Quoted 2 lines

Ben