Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp171366lqb; Thu, 23 May 2024 14:26:36 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXCrLEL+KXslhSU4zkXqanOA4c/zRIpugxPPyn18RTtA4fR2tU5yuygqBFSTQdVHaewPlc3GpHNndDTXeej0gmmrN7Qg4MATXlq3ZJLdQ== X-Google-Smtp-Source: AGHT+IFeqqV/ZTNH+5fKcRp3RhIQCdfMglw1HTVP1Oz+21DTxmC6qoWpmnI0N6Le4toiwyZRvQ1i X-Received: by 2002:a05:620a:11b8:b0:792:902b:2061 with SMTP id af79cd13be357-794ab0ac0cdmr49334985a.32.1716499596571; Thu, 23 May 2024 14:26:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716499596; cv=pass; d=google.com; s=arc-20160816; b=VzIHYcCPnEPitgcWaBWoqFVXDfXP9DLIWVQUQxs2UvdA4SZd5WkLNZ7yn5zMxDPMF0 YObwcVDiTHQcZhJW3I2OjqCp7MU4iPu4FqqWdo4EnfqwTWb/k7VEafBGumpQUOVt4EAT g9z8X65rrp82AG+TZ/9t/aGznen4T4kTZCNLkZtQYhluNBrvVbVKCifPplAStn9e3Djz 4g53zi8NJuWTncG+xC/moe1IQSiezkmWdQylMK8j1QiempwEXXTzk7Z/31xhpJdkwiLQ b1J4j5ItuSb2upvEZww4qZaBMHGCOBiwXSVx8mMxPOAFjL0OEhmYPfyq9ox6i+VEAcPQ vh6w== 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=kI88RVZJD/4isB1G+exybP1Osd/iM6sCMXU1mfKXzdM=; fh=6yufymqy6uxIIWc6xV/8GwxVZUDgLJr8k4qnvsqk11c=; b=B1/jr8B2v9Oa7HcXr2G2STGckbZy0OhWepll8GujnQW/kteaYQGMt0iRc5BYaNPHFe 86yiZMIGxWlQAr38ZZHNuRCtKAvrpLBEOopnFgVFvL2FZItlqlP0qX4G2rFP+AQJUAug FV2LW8IsgTkREg+UQnkIuliacsLpMyApfhBWSvqd1MNyPniKsqvtdW82gIuLBfK4uUcl ZujwaB0DD7u60VbIGgf0piw6csmX7ihH7R6hrwfWcNxdb6CZupmHTcD8oveEMFct1rvt IVf7f95IkXdE+8OVyXQDKe6yylujjhZR3KmnfJmbsshcH086s8l8BAXyimYfA7PvLdYQ bqew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BumYdKQn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4374-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. [147.75.199.223]) by mx.google.com with ESMTPS id af79cd13be357-794abcab653si8552585a.121.2024.05.23.14.26.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 14:26:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=BumYdKQn; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4374-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4374-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 4294B1C2303C for ; Thu, 23 May 2024 21:26:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 36335129A7F; Thu, 23 May 2024 21:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="BumYdKQn" 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 D63AE129A7E; Thu, 23 May 2024 21:25:31 +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=1716499532; cv=none; b=jSF0zYuA44M2pfm0CTmwN04r5UJxgEJ5eGMfPCAwKoE9g+YOIA2Jf3dxxhTjtIIq4hGQ0iGAPUnQ/JLk9xCix9qOP6ZDLSKgob9u0pfX0ygGr/fvUyXHfri4LRnbGeJ05EampQ7ZUbOh89pOvcqIIWhhV0IMI8X6eAlIQPgAoIE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716499532; c=relaxed/simple; bh=mZRcz9OSsK8uHOdUCIoBp+dhRpamjTsxuYIFBW19txc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=bE0vCS0p9YgY/XpXEj4bKr2K4D6NS5reaohvUtUIuXRPwVojyk/qWoV4NqW0GATYD+tG7U/aGlvZh7UoVvlKSN3F54nRUJjOXI7YGxzwbco0x3AaIAWg/QWPi2MEej2nCa7j9NlJ+h2DloHoRA7GBgdbcUBes58fndsL+vjarHw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=BumYdKQn; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2D3A8C2BD10; Thu, 23 May 2024 21:25:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716499531; bh=mZRcz9OSsK8uHOdUCIoBp+dhRpamjTsxuYIFBW19txc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BumYdKQnELuTPRp0l7eqQTH5Yufjq43sYVnyjnY7W9gEpJV/gnPl18raTcrnNtlzj LOGzW8xC6DTWvfUbRR2ILmN8/59LHkq9bmmJ9Vl+l9CE7TxzgSdzVsNht4+Pgr94a1 P7hFYB3HahWk4ALeyFLpxMt+9ng2XV+rluqRvDTjhOK+6jsZk18YpX5E2fL+Jy8PUu QoRnlNBQmh29lBQTyeXu8QfURqSPxBSyJFIei/kvmZRM8NAAYC5yxDCNdDC2OWOQ1m QBMcuqcLB6KJv+1eBKpVyuyXsweGpHDmB6h/0XdYg5OBdbsswF1o/XSmDXcK3XXj6F 4b4JvdlchD3aQ== 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, 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 v5 2/5] KEYS: trusted: Change -EINVAL to -E2BIG Date: Fri, 24 May 2024 00:25:03 +0300 Message-ID: <20240523212515.4875-3-jarkko@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240523212515.4875-1-jarkko@kernel.org> References: <20240523212515.4875-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 d478096cb5c1..7317e07440c3 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