From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 4D8093537DF; Fri, 24 Apr 2026 13:44:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777038287; cv=none; b=qsXc796fXrEyQPmjaMwsY94X+P8c4Ab5w613m8FZ+Y+JPZb945RBiNunKhx9+K6LQaiWjLf3Vint11n/zeYzLKYADA9sl7J1vZtiL1mzd0ehDCZLYMZC+wv0+9rPE5nmyuYX2ADfhVRxeBue8414hd0ZWI6tLvg4bkPEJWzUcVk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1777038287; c=relaxed/simple; bh=UVkgQpV0lIwiXcYXNd2iR4m9MQNVpbGKntqfaygxYUI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kdh5IBw5vqq8mx5jrBFdOq0m8ANJ2F7bJl+Dk5rzc97mTYyxUYDXR0Tmkv/vlDvyVhNgv8F2GqUR1QyyYUgPrtCfcnk9srkeV4lCOR9WTfbFNseFUTq3Pqijq7dxtSotb6bbPjVhOJqgR5KX19uTR5YfMEbMajSFT2RgEcpYCV4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=d3NNI1AX; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="d3NNI1AX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id B2BD0C19425; Fri, 24 Apr 2026 13:44:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1777038287; bh=UVkgQpV0lIwiXcYXNd2iR4m9MQNVpbGKntqfaygxYUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d3NNI1AXBweBHw4knbGi7FS8+cjGmijS58Sur+rZ7Ac6ftQ85PUsyKbU3FUR/Hqql 4lhOVqjKalcbdN5g0hY34Ib6zFNnNwt2j95c5ja2KjsqLlDjoXn2f44z11v4qH5Uwa KonNColIJMb2ilSJA5/Lx1XVU1Eg/ybZdh4HDusE= 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.12 13/35] rxrpc: only handle RESPONSE during service challenge Date: Fri, 24 Apr 2026 15:31:20 +0200 Message-ID: <20260424132414.436666103@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260424132411.427029259@linuxfoundation.org> References: <20260424132411.427029259@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.12-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 spin_lock_irq/spin_unlock_irq calls to spin_lock/spin_unlock ] Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/conn_event.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) --- a/net/rxrpc/conn_event.c +++ b/net/rxrpc/conn_event.c @@ -233,6 +233,7 @@ static int rxrpc_process_event(struct rx struct sk_buff *skb) { struct rxrpc_skb_priv *sp = rxrpc_skb(skb); + bool secured = false; int ret; if (conn->state == RXRPC_CONN_ABORTED) @@ -245,6 +246,13 @@ static int rxrpc_process_event(struct rx return conn->security->respond_to_challenge(conn, skb); case RXRPC_PACKET_TYPE_RESPONSE: + spin_lock(&conn->state_lock); + if (conn->state != RXRPC_CONN_SERVICE_CHALLENGING) { + spin_unlock(&conn->state_lock); + return 0; + } + spin_unlock(&conn->state_lock); + ret = conn->security->verify_response(conn, skb); if (ret < 0) return ret; @@ -255,11 +263,13 @@ static int rxrpc_process_event(struct rx return ret; spin_lock(&conn->state_lock); - if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) + if (conn->state == RXRPC_CONN_SERVICE_CHALLENGING) { conn->state = RXRPC_CONN_SERVICE; + secured = true; + } spin_unlock(&conn->state_lock); - if (conn->state == RXRPC_CONN_SERVICE) { + if (secured) { /* Offload call state flipping to the I/O thread. As * we've already received the packet, put it on the * front of the queue.