Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2409310lqb; Mon, 27 May 2024 20:52:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXyMSQ6NJ/MCqcwS32QsFLgWIrglkKbExeIusKYzkD9KFAN03cxkY4J4fBglelUrtyGJKfEIEZIQOlWgoq3QYDwsGEwyyO6RWGv8C0a9g== X-Google-Smtp-Source: AGHT+IEO5QvOWy9UMHGmZFnMZ/sNDGqhHRQofKFLaB0NeqUrGUIbCwOBcXqhfMpKFocCT9AIhGPG X-Received: by 2002:a25:9348:0:b0:df4:d5d2:b524 with SMTP id 3f1490d57ef6-df772184a6cmr10698544276.14.1716868357255; Mon, 27 May 2024 20:52:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716868357; cv=pass; d=google.com; s=arc-20160816; b=XD9Ty9Id72CwhfDGka5KFWSin/+oCLZq1iZIlAcRhNtZFTgxkhvQOu9zXAnBn95hQi madByIB60byPFl924bZecWK+GMIcg7oJie3uRU6qa74m4XmeYN8+v61w8DvMCfFLidsb CHT9+w0SbuOImDfIgMZTw3mJaw4bkDF2ukzD32aOuvXXpzWCFfaYL4zUT+MqlKeyAd9k NG+by6yptSpNppfzZt5zsXTm5rDqArDTjxAxTug72+lfEuLulHONrNMV4GTvMFUpzu8t XFH0gbR2IeOgDWE5Pg8QkQ3N5KONGK3b3ri8rnQICli4A0c8qXcslnT3hsqCSluGB5PW eBCA== 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=rEgCHSRScNKN0rch9DuSshqzGunJdggGgyIuMr4Tvv0=; b=fQMgTWF971MvQ3EzvUWcwlsVhuUSCvghs/uTA8E38lF+lPmI/thcqBBag/i1/eAsIE NFyK+Zt7aV/2DEe+dXeANYndAVVEnOHdJgOeHn20Y/znWFsMtjXrbcARZGNj6TZikYs2 yEDVAdxxA9PmdnYuuaiv8/nNmzve85mXpLf6ct9HN2CGUvosMet7OQGkmwe4tl4S6uCc r/eDgT6QaIi0gizVqrh94DJen6BorBWUCQgV+ju0VLIqMBrhgv9LXFM/WqFIMVN8fr6I 9+MqXgj/ftNlb0yW6nkT13Hoa6Yd/sGh8N79gs9/xToCLyL9wWVi4Y25jt1SDCXUniPL Hasw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=DMR4uXbx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4435-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 6a1803df08f44-6ac070f0abesi100185386d6.304.2024.05.27.20.52.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 20:52:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-crypto+bounces-4435-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=DMR4uXbx; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-crypto+bounces-4435-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-crypto+bounces-4435-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 0152C1C2182B for ; Tue, 28 May 2024 03:52:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A0ABC17BD8; Tue, 28 May 2024 03:52:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="DMR4uXbx" 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 4EC7538DD4; Tue, 28 May 2024 03:52:01 +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=1716868322; cv=none; b=J5YaxeMKl7kTIHTsy2P8y86NtcyMo6ituUweT8T6CXAHosh2ps7U1RnGmbTn2JrFI6gAfwVnivTmnjJ+5h6OrRec1UFuSUVD4MHRa0HnvPMr7jG9FwICg3o9KaKVkNnhVh6TxOZNQLpmaLdsMKu4UOHrHi1TCfGAsiJLjtA2AL8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716868322; c=relaxed/simple; bh=h8orBF4zzRfW1mNSKt+5IoMKfbFfiHan4PWjJTDQxIE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Xu7IlmlXWVRv+pswWsSzGcTg9UQef/En/4OLQpyiTR9IKtLguaAXDJ4TNMTRBKa7YjjDvQDO2YsI6IrbSgx9iGJdfJuMvQp0JlNV6U1fw/6+cjHsniD60KDZib1mdZWHay6evkZR1ya+ZeDSUMoLMVIWsIwayBFRNZ2WPaXv4gM= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DMR4uXbx; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3DE52C3277B; Tue, 28 May 2024 03:52:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1716868321; bh=h8orBF4zzRfW1mNSKt+5IoMKfbFfiHan4PWjJTDQxIE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DMR4uXbxPtMAAUSDyjM0JaGvYfg95UpO8ERhJg1kuQ1NZQlv5asuLufFPLmH8X1/i JO1mODpqnsFGWlgfYu7IyKMRNDDqTowWakrJ2j7doKBVAYJgucOebgf7t4TDu1+gwo ZrLeTqIFxuOLt+Xn6CAhe/g2CvM/5ohEIyeCYHioYRRSWEEQyAaU32MemP3t2nN6qe mbAsY4Qf82aMGXMjGf/lAXSvKKNJTT9UHHEzigP5wzd2irOP9aJFXHVlNOfYqC7mt4 mwVU2SdFbSs4EUZwh5vox+vpasfqjVm6UGq3BKsm4si84c/QPk/zdE3evigcnw8TKc K7zW1IEcnu2Nw== 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 , 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 v6 3/6] KEYS: trusted: Change -EINVAL to -E2BIG Date: Tue, 28 May 2024 06:51:18 +0300 Message-ID: <20240528035136.11464-4-jarkko@kernel.org> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240528035136.11464-1-jarkko@kernel.org> References: <20240528035136.11464-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