Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp237118lqb; Tue, 28 May 2024 14:10:21 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUpGl4vU+5y9uWOxZJRHQKtRWCy/S9QRDbBbcwMjpYMp4olxMUdTHQHE7eP/iHB3QZvvBaPJbo3zpkST2Vhfl0GgG9MbE6j9MC0LHrJSA== X-Google-Smtp-Source: AGHT+IHriANfB62HmYe5vLqoZSZ4KUKR+D2Qgw8e5nrGqy/4safqLiF+l+Dw8hIljCf/Ws5Zi5Ep X-Received: by 2002:a05:620a:5648:b0:793:66:c3f6 with SMTP id af79cd13be357-794ab11499dmr1252537585a.52.1716930620703; Tue, 28 May 2024 14:10:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716930620; cv=pass; d=google.com; s=arc-20160816; b=jNILKoTQh/7Ut0wJHSJDAG+rcKIVV0EGihycV6d/JqHlqfjO7lSyMbfjX/dA3RKwqu qzfQ28mZEgXdwjSbiAX78XQIkAFTttFZT4X1erl0Zv75BmJrPb0i2LLteQGVKuG21mC5 tGKqb1MW0IaxmgEEeDVo0ZOoJRa8Ye5/LC0AU2B1p2RljaCJuI1Sz49byoNlhC931Ryf sRseuiFSTUZ8V5C0H6SEzrNm9n8+Fa5se3JyfiylV94ocjHoTd5XOPPJnS/yjgsHyAxa kaDVGiBccTcN523yiASU72Zwov8e9Hmb0qyeeOPZz45FPbyW94uApXtApAQfwVP3CKVc 9ZgA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=Xo0PFnfVjXdTd28RrpX0+9DeicNHF9S2993QS39pz8Y=; fh=1i9FY3/WpR/brkssix8JO+Zj111XamKz9MWkq22nJak=; b=prtcNMcn2n+asmY9iDiZSF2SAWAN5hODoS5QwbgBOahbKBd5YBJ6S4NrMOlkZZ5ntQ I++VvZrutPqt6cHws3O7nR82BFN1efx0tpsR9Cu8L481vOf21kwkrB+fnBuRAi8XbJ5g +bHP0lP4B2JkySvFGbIf+oSBuwX1iYCMyiwrbJVJIJscAxDuh9nbbHuMjZJI835LoBC/ VEY72wsEManUrS1AHK1+6D0AR5TWsMD6mO/tnTzDmVKb/ehaa1wRO4mtrBfUtbZHcla6 H65SsASMaHNARHS+baAFtgdwETVTQv03lAhhK28hoQkOQt1KrUee+pKVM5BWstpSTank cVvQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PmkhGx7V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id af79cd13be357-794abd1730csi1247199085a.288.2024.05.28.14.10.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 May 2024 14:10:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PmkhGx7V; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4478-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4478-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 6F5B71C254CA for ; Tue, 28 May 2024 21:10:20 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98FF117F36F; Tue, 28 May 2024 21:08:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PmkhGx7V" X-Original-To: linux-crypto@vger.kernel.org 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 4874B17F36D; Tue, 28 May 2024 21:08:38 +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=1716930518; cv=none; b=AzcfZdW+v+cvreEDCqMOLCJlltOKQdpcDnu9JqrJYwI+pmf+zeRN34jcUMSVkS+1ijyfnNhrU/qlQ8jt2xhRM/JfJ364Omhg3l+2XEQJgmciCS/2Lp5HxaGrqBmuPg7JiZ6QsA+SRTtI6KI/KztzzB+ihJrVRwMwjiB3OruIFuw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716930518; c=relaxed/simple; bh=h8orBF4zzRfW1mNSKt+5IoMKfbFfiHan4PWjJTDQxIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pL+5cP6ssRZMGIXlXJIkIsD+1g2DKGAwURuGEs/3PQv3E5yZJfm34SwenzZZJ9wCkwebXmBtbNGDkzFjKEvzl03VFJHXGuAmrGo4dEwGxcdvII+2aWgk6m6RtdEYzU41gn67quSFvtpAjz+LcZwY0LU0uUgq0tTX2hgxuDZynck= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PmkhGx7V; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF93EC32786; Tue, 28 May 2024 21:08:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716930518; bh=h8orBF4zzRfW1mNSKt+5IoMKfbFfiHan4PWjJTDQxIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PmkhGx7V8i6zLjttIWkdl+8o0Y5vSXsPkxD8AI5uBF0zi8KAAMZG+viURTxW6P/fa l3Ftx2zJfbVW6E0/rlu5cceP7gYnl9mYX3QZF8MZICsw9z4SOLoGWqARBJvPnUtOJn rXM1sgkXv/IuMaSIgX3jYcPWpHZgQ4bFarvPb/eYJf3s2om5AczldRaBVNJ8s7Mtum 86SAbCDdpNJuZ40qpo4aUCiIqt9lfEmXU1FA0HJlgJkq/O6JpSje82xJjagHnLMebc kW+MZaYaIftO4Cd8UuadqVDEyE4lnR4fZgFCsv5UQuvtn92uXtyCwxsSZxJUZaPmq7 WOakhQOBYGmxA== From: Jarkko Sakkinen To: Herbert Xu Cc: linux-integrity@vger.kernel.org, keyrings@vger.kernel.org, Andreas.Fuchs@infineon.com, James Prestwood , David Woodhouse , Eric Biggers , James Bottomley , linux-crypto@vger.kernel.org, Stefan Berger , Lennart Poettering , Jarkko Sakkinen , "David S. Miller" , linux-kernel@vger.kernel.org (open list), James Bottomley , Mimi Zohar , David Howells , Paul Moore , James Morris , "Serge E. Hallyn" , linux-security-module@vger.kernel.org (open list:SECURITY SUBSYSTEM) Subject: [PATCH v7 2/5] KEYS: trusted: Change -EINVAL to -E2BIG Date: Wed, 29 May 2024 00:08:07 +0300 Message-ID: <20240528210823.28798-3-jarkko@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240528210823.28798-1-jarkko@kernel.org> References: <20240528210823.28798-1-jarkko@kernel.org> Precedence: bulk X-Mailing-List: linux-crypto@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Report -E2BIG instead of -EINVAL when too large size for the key blob is requested. Signed-off-by: Jarkko Sakkinen --- security/keys/trusted-keys/trusted_tpm2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/security/keys/trusted-keys/trusted_tpm2.c b/security/keys/trusted-keys/trusted_tpm2.c index 8b7dd73d94c1..06c8fa7b21ae 100644 --- a/security/keys/trusted-keys/trusted_tpm2.c +++ b/security/keys/trusted-keys/trusted_tpm2.c @@ -122,7 +122,7 @@ static int tpm2_key_decode(struct trusted_key_payload *payload, return ret; if (ctx.priv_len + ctx.pub_len > MAX_BLOB_SIZE) - return -EINVAL; + return -E2BIG; blob = kmalloc(ctx.priv_len + ctx.pub_len + 4, GFP_KERNEL); if (!blob) -- 2.45.1