From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id ED5223264DC; Sat, 30 May 2026 16:48:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780159712; cv=none; b=Yv+sVCJRE/ulDxsLdJYzJ+fsBchy/6gO78JJp/v72LTq1eyIThvGsdgZ3tTbblRDz0DsMlPih5nC2lE+ocuFs/woLY+ZE8HZJKwz0ygJ/KxgVuIUWA2+X30GQrMgot6ojDrresY9LQ9nklq0x9rtpjQKrsg7/gUMJ3mXi9zmrQ0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780159712; c=relaxed/simple; bh=sweTzWAEJOPOfrhrNCbnmGY7gLmhDAMyj1HhsJ4a+yc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=EQ+FY0HDi0JK69M0QEJGdyRAClzoAvkDyzlIiDjUzsVP7LQvjPs+dHlLWxJtwN+LwcILkttqbRxz9oHL6X/pkenV+4M02x+ypfpUqU8qEcjOUjFCYF7tkGUO1X2iLPfCDWuLH/avbmCT5VAi0Hk9M/LcMerkJSKqgYOIJLUjjXE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=IyX/tmrh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="IyX/tmrh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 07AAA1F00893; Sat, 30 May 2026 16:48:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780159710; bh=6UIjDRY6jC/9veh71WZSwb4ISZhMBDINW99ze0ZduKI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=IyX/tmrhYky1fk1tGX5D7yr69wJd/6OkwmM1805b7KokI2CnrYu7a4vuKkETw6hJX SEj94UiVkdaWbJ61YlUKRumXSoRWvZBoyFQoBwMe8xAIzRUrzUZT2ddICABaKv4v4A 33JJ7aV4ekBbDb/0tUcrpNdWVASQRtaOoFYE7Xgw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Yifan Wu , Juefei Pu , Yuan Tan , Xin Liu , Jie Wang , Yang Yang , David Howells , Marc Dionne , Jeffrey Altman , Simon Horman , linux-afs@lists.infradead.org, stable@kernel.org, Jakub Kicinski , Sasha Levin Subject: [PATCH 6.1 142/969] rxrpc: only handle RESPONSE during service challenge Date: Sat, 30 May 2026 17:54:26 +0200 Message-ID: <20260530160304.480888932@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160300.485627683@linuxfoundation.org> References: <20260530160300.485627683@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Wang Jie [ Upstream commit c43ffdcfdbb5567b1f143556df8a04b4eeea041c ] Only process RESPONSE packets while the service connection is still in RXRPC_CONN_SERVICE_CHALLENGING. Check that state under state_lock before running response verification and security initialization, then use a local secured flag to decide whether to queue the secured-connection work after the state transition. This keeps duplicate or late RESPONSE packets from re-running the setup path and removes the unlocked post-transition state test. Fixes: 17926a79320a ("[AF_RXRPC]: Provide secure RxRPC sockets for use by userspace and kernel both") Reported-by: Yifan Wu Reported-by: Juefei Pu Co-developed-by: Yuan Tan Signed-off-by: Yuan Tan Suggested-by: Xin Liu Signed-off-by: Jie Wang Signed-off-by: Yang Yang Signed-off-by: David Howells cc: Marc Dionne cc: Jeffrey Altman cc: Simon Horman cc: linux-afs@lists.infradead.org cc: stable@kernel.org Link: https://patch.msgid.link/20260408121252.2249051-21-dhowells@redhat.com Signed-off-by: Jakub Kicinski [ adapted to spin_lock_bh usage, 3-arg verify_response(), and direct rxrpc_call_is_secure() ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/conn_event.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c @@ -293,6 +293,7 @@ static int rxrpc_process_event(struct rx u32 *_abort_code) { struct rxrpc_skb_priv *sp = rxrpc_skb(skb); + bool secured = false; __be32 wtmp; u32 abort_code; int loop, ret; @@ -337,6 +338,13 @@ static int rxrpc_process_event(struct rx _abort_code); case RXRPC_PACKET_TYPE_RESPONSE: + spin_lock_bh(&conn->state_lock); + if (conn->state != RXRPC_CONN_SERVICE_CHALLENGING) { + spin_unlock_bh(&conn->state_lock); + return 0; + } + spin_unlock_bh(&conn->state_lock); + ret = conn->security->verify_response(conn, skb, _abort_code); if (ret < 0) return ret; @@ -348,17 +356,18 @@ static int rxrpc_process_event(struct rx spin_lock(&conn->bundle->channel_lock); spin_lock_bh(&conn->state_lock); - if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) { conn->state = RXRPC_CONN_SERVICE; - spin_unlock_bh(&conn->state_lock); + secured = true; + } + spin_unlock_bh(&conn->state_lock); + + if (secured) { for (loop = 0; loop < RXRPC_MAXCALLS; loop++) rxrpc_call_is_secure( rcu_dereference_protected( conn->channels[loop].call, lockdep_is_held(&conn->bundle->channel_lock))); - } else { - spin_unlock_bh(&conn->state_lock); } spin_unlock(&conn->bundle->channel_lock);