From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796380372; b=EDSynNBbbBnZckQ0lsBVFPyavLBWW6FbIqNd1cUVCt33/KxDeZQUIpJ04ItEdFhFcqfz FufYpi1+AlQycaU+8qxrNvPRzTvSaB2kWKdHNTQW6Pjb0A8yVzqjBiSEX0c/ScIHrqHkM /gZEC4P2Yt8WqX0qt8istE2TTPiPII487gPpU7r2rfX28xG+8qy7Yox7cIRppMRW6YISk WgGO7FBpqv9SfzKxroEEzbBZTZ9kse5DmuDpiVJQPVW9iK4YdFYWfw4+WzOPBaB+zcSzI Vsl90rQA+5n+CiVXxuD5EfoW7ResQ15i+k6umNIFN0FTTbCHsl0YMToiAx02kiQfAWw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796380372; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=/D/IC1pjkL4E6XK3072yxtxfL8gXmXIe+bx1x8/WKl0=; b=jl3rj3153zNlGKzZdvdojWr6NbNSR31BO89fgzPfXmO//slWD7G4e9/1wemvMkK9/mNM A3VWmxXfIZw7A7IsALaCqalnEnjikGbLb6/y/RDwSR0mCkv0U2qVfdCrbEruduohLza7p Om5D19foHeqW17kzZKGVlGr0UWAsnC2MIRqinfA8x+v+eMVLwpYCIK/xpctpImncxWETJ o4Y13u5kt5UQEOKhJlXWp0LKtsMT/01pIEEEMQsHkCGiQwBJRBNgHNC9ksEWB7DAW0/T2 MjRF7A4/3kGKwNzPSo/nu6ORHkwBUcvsk7B/HB7BOI2JS6Jhr20iUCtlEvBs0Kjq2pg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b="Oj4iyS/d"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 83050606A322; Fri, 4 Dec 2026 10:32:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=Oj4iyS/d Received: by smtp.kernel.org (Postfix) with ESMTPSA id A91E11F00A0D; Fri, 4 Dec 2026 10:32:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796380372; bh=/D/IC1pjkL4E6XK3072yxtxfL8gXmXIe+bx1x8/WKl0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=Oj4iyS/diuyGEnzWxcQZYNS3rEzRl6Hh2DhrodrkIvOP61F6mC1rr7WfcvZ9baxbm Y+Kj1xJzWj52vSY/pMbyntIau7rjZ0tQxerFVsbYI3Ci+sudkLC/g6b4DwbTIbREK0 RcflfhaOshD24gn3UnxQD+WNpSxPHTAAdDKv6PCI= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Keisuke Tsukuda , Serge Hallyn , Jarkko Sakkinen , Sasha Levin Subject: [PATCH 7.3 244/742] KEYS: trusted: caam: propagate protected key option parsing errors Date: Fri, 4 Dec 2026 19:01:48 +0900 Message-ID: <20261204100641.548694264@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100635.034361255@linuxfoundation.org> References: <20261204100635.034361255@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 7.3-stable review patch. If anyone has any objections, please let me know. ------------------ From: Keisuke Tsukuda [ Upstream commit 1bbbf65c75064aeaff793b7bc218f12c53cbe1a9 ] get_pkey_options() returns -EINVAL for invalid protected key options, such as "key_enc_algo=GG". trusted_caam_seal() and trusted_caam_unseal() ignore this error and return 0. The trusted key core then instantiates a key without a blob for "new", or with a zero-length key for "load". On an i.MX6Q running a 7.4.0-rc2-based kernel, adding a key with "new 32 pk key_enc_algo=GG" succeeds, but KEYCTL_READ returns zero bytes because no blob was created. The key cannot be saved and reloaded. Return the parsing error from both paths. On the patched kernel, "new" and "load" with "key_enc_algo=GG" both fail with -EINVAL, while valid requests succeed. Fixes: a703a4c2a328 ("KEYS: trusted: caam based protected key") Signed-off-by: Keisuke Tsukuda Reviewed-by: Serge Hallyn Link: https://lore.kernel.org/r/20261124155310.32044-1-tkdkei@outlook.jp Signed-off-by: Jarkko Sakkinen Signed-off-by: Sasha Levin --- security/keys/trusted-keys/trusted_caam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/security/keys/trusted-keys/trusted_caam.c b/security/keys/trusted-keys/trusted_caam.c index 6a33dbf2a7f55..33000d7bb1cca 100644 --- a/security/keys/trusted-keys/trusted_caam.c +++ b/security/keys/trusted-keys/trusted_caam.c @@ -110,7 +110,7 @@ static int trusted_caam_seal(struct trusted_key_payload *p, char *datablob) info.pkey_info.is_pkey = 1; ret = get_pkey_options(datablob, &info.pkey_info); if (ret < 0) - return 0; + return ret; dump_options(&info.pkey_info); } @@ -142,7 +142,7 @@ static int trusted_caam_unseal(struct trusted_key_payload *p, char *datablob) info.pkey_info.is_pkey = 1; ret = get_pkey_options(datablob, &info.pkey_info); if (ret < 0) - return 0; + return ret; dump_options(&info.pkey_info); p->key_len = p->blob_len + sizeof(struct caam_pkey_info); -- 2.53.0