From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (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 E1D8E4A1E1C for ; Mon, 7 Sep 2026 11:38:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788781130; cv=none; b=BGjrL1DZRVhUEGo/avAz7Azvfx6N8DiAAe4HVd6rYelHahyssU6nLXdT/06lxhMNhuSyCyafK7QJ/aDSSUpnVh7r5/8wWTR+dd5yhGQTH0h428oZGlGtWSaLEcbfFVhGCGMlZ0aqVF+btiYLRZcA5RteWDWz+wmqZXIK/1vcGp4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788781130; c=relaxed/simple; bh=H8CelOzBhdyJycz+48X32xmmg9a1hcbq/jHJ8CGuWNY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nW2HHZ6av/By81c5ns3gPbdC3kmTt4RLRyCItmBixp9GP0J+BxykRSDxR1BVAVva2w/u56eMx7KvW1W/yI1b5Gu+s0pLLG61Tcsug2TOaBAJf0FZaHrV8UQGbdsPoT+Ns9Ei00lEhLx1a1RWBT0wAwSE8I6Efm1i7f6ig09AfA8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=W+rdNoxK; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="W+rdNoxK" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1788781126; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=MCtf6xRVznBmbNbbW++7i1w457e6VKnTXFN367d2vAQ=; b=W+rdNoxKDqlJ105BQrZddq3zCU5djm3vfsXeFjQwdfh/u3X10UFVoP9D5AyZ6drNP5G7GC YtmwdzgCoZfy7vLkjZ6XcxQeE2EUYGKwo8KSf0iMvCJgJuPKxtjutE13WV2m6UlHWpEQ1s xs9z55Mch+BRkPwwYo1F1cDJw6bt434= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-297-yjjAAUx8NEKwFfGsxt4i4A-1; Mon, 07 Sep 2026 07:38:43 -0400 X-MC-Unique: yjjAAUx8NEKwFfGsxt4i4A-1 X-Mimecast-MFC-AGG-ID: yjjAAUx8NEKwFfGsxt4i4A_1788781122 Received: from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 02F921954AFF; Mon, 7 Sep 2026 11:38:42 +0000 (UTC) Received: from warthog.com (unknown [10.44.32.158]) by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id E45C71800257; Mon, 7 Sep 2026 11:38:38 +0000 (UTC) From: David Howells To: netdev@vger.kernel.org Cc: David Howells , Marc Dionne , Jakub Kicinski , "David S. Miller" , Eric Dumazet , Paolo Abeni , Simon Horman , linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org Subject: [PATCH net v9 10/14] rxrpc: Fix RxGK key parser to check enctype is supported Date: Mon, 7 Sep 2026 12:37:37 +0100 Message-ID: <20260907113743.1453210-11-dhowells@redhat.com> In-Reply-To: <20260907113743.1453210-1-dhowells@redhat.com> References: <20260907113743.1453210-1-dhowells@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.111 Fix the parser of RxGK keys supplied by userspace to check that the specified encryption type is supported. Fixes: 0ca100ff4df6 ("rxrpc: Add YFS RxGK (GSSAPI) security class") Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20260824091645.415423-1-dhowells%40redhat.com Signed-off-by: David Howells cc: Marc Dionne cc: Eric Dumazet cc: "David S. Miller" cc: Jakub Kicinski cc: Paolo Abeni cc: Simon Horman cc: linux-afs@lists.infradead.org cc: stable@vger.kernel.org --- net/rxrpc/key.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/net/rxrpc/key.c b/net/rxrpc/key.c index a0aa78d89289..30d6db052c21 100644 --- a/net/rxrpc/key.c +++ b/net/rxrpc/key.c @@ -172,6 +172,7 @@ static int rxrpc_preparse_xdr_yfs_rxgk(struct key_preparsed_payload *prep, const __be32 *ticket, *key; s64 tmp; size_t raw_keylen, raw_tktlen, keylen, tktlen; + int ret = -EKEYREJECTED; _enter(",{%x,%x,%x,%x},%x", ntohl(xdr[0]), ntohl(xdr[1]), ntohl(xdr[2]), ntohl(xdr[3]), @@ -229,6 +230,11 @@ static int rxrpc_preparse_xdr_yfs_rxgk(struct key_preparsed_payload *prep, token->rxgk->key.data = token->rxgk->_key; token->rxgk->ticket.len = raw_tktlen; + if (!crypto_krb5_find_enctype(token->rxgk->enctype)) { + ret = -ENOPKG; + goto reject_token; + } + if (token->rxgk->endtime != 0) { expiry = rxrpc_s64_to_time64(token->rxgk->endtime); if (expiry < 0) @@ -280,7 +286,7 @@ static int rxrpc_preparse_xdr_yfs_rxgk(struct key_preparsed_payload *prep, kfree(token->rxgk); kfree(token); reject: - return -EKEYREJECTED; + return ret; expired: kfree(token->rxgk); kfree(token);