🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: linux.kernel.netdev
1 messages
1 total messages Started by Lin Ma Thu, 19 Nov 2026 03:45
[PATCH] net: rxrpc: Reject previous RxGK key at key zero
#18940
Author: Lin Ma
Date: Thu, 19 Nov 2026 03:45
52 lines
10558 bytes
rxgk_get_key() and rxgk_rekey() compare the wire key number with the low
16 bits of current_key - 1 without checking that current_key is nonzero.
On a new connection, cksum 0xffff therefore selects UINT_MAX as the key
number.

The missing key slot makes rxgk_rekey() derive a new context from keys[0]
and overwrite that slot with crank false, losing the reference to the
original context and leaving the connection with the wrong key state.

We verified the path using a real AF_RXRPC client and a raw UDP server that
sent a DATA packet with cksum 0xffff.  The run reported five suspected
leaks; two objects had an allocation backtrace through
rxgk_generate_transport_key(), rxgk_get_key() and
rxgk_verify_packet().  The slot overwrite and lost context reference are
established by the source-level ownership analysis.

Reject the previous-key match while current_key is zero.

Fixes: 7a7513a3081c ("rxrpc: rxgk: Implement connection rekeying")
Assisted-by: Codex:GPT-6 <codex@openai.com>
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 net/rxrpc/rxgk.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/rxrpc/rxgk.c b/net/rxrpc/rxgk.c
index f9f5a2dc62ed..0a62475691f7 100644
--- a/net/rxrpc/rxgk.c
+++ b/net/rxrpc/rxgk.c
@@ -100,7 +100,8 @@ static struct rxgk_context *rxgk_rekey(struct rxrpc_connection *conn,
 	} else {
 		if (*specific_key_number == (u16)current_key)
 			key_number = current_key;
-		else if (*specific_key_number == (u16)(current_key - 1))
+		else if (current_key > 0 &&
+			 *specific_key_number == (u16)(current_key - 1))
 			key_number = current_key - 1;
 		else if (*specific_key_number == (u16)(current_key + 1))
 			goto crank_window;
@@ -185,7 +186,8 @@ static struct rxgk_context *rxgk_get_key(struct rxrpc_connection *conn,
 		 */
 		if (*specific_key_number == (u16)current_key)
 			key_number = current_key;
-		else if (*specific_key_number == (u16)(current_key - 1))
+		else if (current_key > 0 &&
+			 *specific_key_number == (u16)(current_key - 1))
 			key_number = current_key - 1;
 		else if (*specific_key_number == (u16)(current_key + 1))
 			goto rekey;
-- 
2.56.1
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads