Netdev List
 help / color / mirror / Atom feed
* [PATCH] net: rxrpc: Release challenge connection ref on abort
@ 2026-11-18 16:48 Lin Ma
  2026-11-18 16:52 ` netdev-bot+sinfo
  0 siblings, 1 reply; 2+ messages in thread
From: Lin Ma @ 2026-11-18 16:48 UTC (permalink / raw)
  To: David Howells, Marc Dionne; +Cc: netdev, linux-afs

A challenge can abort a connection during validation.  The caller may then
queue the challenge with an extra reference to that connection.  If the
connection worker sees the abort first, it drops the skb without dropping
that reference.

Check the connection state again after validation and release the challenge
reference when an aborted connection discards a queued challenge.

Fixes: 5800b1cf3fd8 ("rxrpc: Allow CHALLENGEs to the passed to the app for a RESPONSE")
Assisted-by: Codex:GPT-6
Signed-off-by: Lin Ma <linma@zju.edu.cn>
---
 net/rxrpc/conn_event.c | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/net/rxrpc/conn_event.c b/net/rxrpc/conn_event.c
index 98ad9b51ca2c..bdb762b2fc05 100644
--- a/net/rxrpc/conn_event.c
+++ b/net/rxrpc/conn_event.c
@@ -249,8 +249,16 @@ static int rxrpc_process_event(struct rxrpc_connection *conn,
 	struct rxrpc_skb_priv *sp = rxrpc_skb(skb);
 	int ret;
 
-	if (conn->state == RXRPC_CONN_ABORTED)
+	if (conn->state == RXRPC_CONN_ABORTED) {
+		/* A challenge queued before the abort still owns a conn ref. */
+		if (sp->hdr.type == RXRPC_PACKET_TYPE_CHALLENGE &&
+		    sp->chall.conn) {
+			rxrpc_put_connection(sp->chall.conn,
+					     rxrpc_conn_put_challenge_input);
+			sp->chall.conn = NULL;
+		}
 		return -ECONNABORTED;
+	}
 
 	_enter("{%d},{%u,%%%u},", conn->debug_id, sp->hdr.type, sp->hdr.serial);
 
@@ -486,6 +494,11 @@ bool rxrpc_input_conn_packet(struct rxrpc_connection *conn, struct sk_buff *skb)
 		}
 		if (!conn->security->validate_challenge(conn, skb))
 			return false;
+		if (rxrpc_is_conn_aborted(conn)) {
+			if (conn->completion == RXRPC_CALL_LOCALLY_ABORTED)
+				rxrpc_send_conn_abort(conn);
+			return true;
+		}
 		return rxrpc_post_challenge(conn, skb);
 
 	case RXRPC_PACKET_TYPE_RESPONSE:


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

end of thread, other threads:[~2026-11-18 16:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-18 16:48 [PATCH] net: rxrpc: Release challenge connection ref on abort Lin Ma
2026-11-18 16:52 ` netdev-bot+sinfo

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