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 3149E3546EA; Sat, 30 May 2026 17:46:09 +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=1780163170; cv=none; b=KkaPBs8fW39fZyz3lDkKq3P3I2pyKjqJWmLxMUjVrkQsKO7RkAbD69DwUBNtGZANe+ppS4xLxJTmQnmAs0uv3nx3spD0B45ZjJHH1kkiHUtFU6p8VqFZAqB0qmfb8U6NSnocoi4eZ6DF10Lg2GcS5FEkcm/ItuBmiF+ocqz5iKg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780163170; c=relaxed/simple; bh=lwqRqj5aKQYCbUZ6za3TCSH+qYojs1/a9pBiw0KHiZQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=n16mAnyU7jg9eU5ISO7IWzAztSmYMmtj1mtmohmqON1PmxX87UWExkGeYcJfytwwP3+DS6c880TbfGQ28dX3MqR2fMj2+3qXCtnEDXZvj4EzIrVRJKwQYOvAu0LddghjLTTk/gU0MCiykbRE6hwBpB4uTk/QfegzFEiw2QmKI2I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=H2SLpFuS; 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="H2SLpFuS" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 75FF11F00898; Sat, 30 May 2026 17:46:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1780163169; bh=0TyNf207hxAMzoh9NiSBYt0YbVAJbFhgjtf7+NZCCUI=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=H2SLpFuSTZFOKvIov6tn+uwaOkiZurnHXl7gHNcFtO9XEiOPL2y1A8lK+WajDzeYD e9N8u+13M+Lg91L0Bp/SosGttN9fo5fd/yZDWSXtMHl0DmbAQT2tMV2oqeC9i6kUrO Zpi8NMbAfPwVmSyc4K98lTJdPUFB46jHArj2C/wo= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Anderson Nascimento , David Howells , Marc Dionne , Jeffrey Altman , Simon Horman , linux-afs@lists.infradead.org, stable@kernel.org, Jakub Kicinski Subject: [PATCH 5.15 178/776] rxrpc: Fix missing validation of ticket length in non-XDR key preparsing Date: Sat, 30 May 2026 17:58:12 +0200 Message-ID: <20260530160245.099832909@linuxfoundation.org> X-Mailer: git-send-email 2.53.0 In-Reply-To: <20260530160240.228940103@linuxfoundation.org> References: <20260530160240.228940103@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 5.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: Anderson Nascimento commit ac33733b10b484d666f97688561670afd5861383 upstream. In rxrpc_preparse(), there are two paths for parsing key payloads: the XDR path (for large payloads) and the non-XDR path (for payloads <= 28 bytes). While the XDR path (rxrpc_preparse_xdr_rxkad()) correctly validates the ticket length against AFSTOKEN_RK_TIX_MAX, the non-XDR path fails to do so. This allows an unprivileged user to provide a very large ticket length. When this key is later read via rxrpc_read(), the total token size (toksize) calculation results in a value that exceeds AFSTOKEN_LENGTH_MAX, triggering a WARN_ON(). [ 2001.302904] WARNING: CPU: 2 PID: 2108 at net/rxrpc/key.c:778 rxrpc_read+0x109/0x5c0 [rxrpc] Fix this by adding a check in the non-XDR parsing path of rxrpc_preparse() to ensure the ticket length does not exceed AFSTOKEN_RK_TIX_MAX, bringing it into parity with the XDR parsing logic. Fixes: 8a7a3eb4ddbe ("KEYS: RxRPC: Use key preparsing") Fixes: 84924aac08a4 ("rxrpc: Fix checker warning") Reported-by: Anderson Nascimento Signed-off-by: Anderson Nascimento 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/20260422161438.2593376-7-dhowells@redhat.com Signed-off-by: Jakub Kicinski Signed-off-by: Greg Kroah-Hartman --- net/rxrpc/key.c | 4 ++++ 1 file changed, 4 insertions(+) --- a/net/rxrpc/key.c +++ b/net/rxrpc/key.c @@ -340,6 +340,10 @@ static int rxrpc_preparse(struct key_pre if (v1->security_index != RXRPC_SECURITY_RXKAD) goto error; + ret = -EKEYREJECTED; + if (v1->ticket_length > AFSTOKEN_RK_TIX_MAX) + goto error; + plen = sizeof(*token->kad) + v1->ticket_length; prep->quotalen += plen + sizeof(*token);