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=1796383456; b=vuccsdmarPmkxaayNU2h34m2zBHyA9XAJI2p65SYj8NrmiyH8xXeSNauDS81onMOlHbJ 0GefrLarc7FKPh+o8LnAL+SNI+Uuh0WpSStKM+u31SqxztcbL3Ix1ja5HqAWdy+fkH3YU uJKdSSRd4Uo8Drkpoeu8rfwuw6F9JhIrf8FgdMj0Tkj7jrMnUc1lyj/nlONOw3zl2Q+DB HJRyrJPc1w7/B1tYzxbUu/RrZ2lqpV1nk6Jm128g0uQ6V37rf3dC98aXyXdjZgm5O82bp YK+B5eF6ja4cY3b5Npmd2cnO68QgOHVA0HpMR9kVsq1bVwhIbbENwrgHvRXyMqH78KA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796383456; 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=4TJzx2vNOpDj+zwjwwPe8mGKs3xYdaVl+W2Jnamv6UM=; b=xwGVYDzTNaEMDgaRB86CicKpplMFG1lVqCsYuSZKSyaFxKaM2ICDPKB+hVu+JjJS4AOm +vCHy2oRjmxMnk5MOpvAGiSApaxtCqgcPhP3yLfZNvWcQ4O1NW0fNoUNjlBM8NudWMCGI bUkrTMhZrpb1qUyjaDdorH6vO0ymxozlT+/diyGaKznVL4C7SJ4C7Xg0coI8ZEtxiaZoF tLeuCOiJVbfyKEDY7WJKXKB1zmgsjKb8rJMLC3K1mLlU6San25NYNZ4KlI5QOUlaTKP4D LQYPvAzkcEX0o67BhzPNoAbTVZhUBLIc0g559JwSEz1s0MqcKDHzY655jq6GzJl1bhw== 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="a/CIyj8V"; 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 1B55A60A2624; Fri, 4 Dec 2026 11:24:15 +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=a/CIyj8V Received: by smtp.kernel.org (Postfix) with ESMTPSA id 312F01F00A0E; Fri, 4 Dec 2026 11:24:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796383455; bh=4TJzx2vNOpDj+zwjwwPe8mGKs3xYdaVl+W2Jnamv6UM=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=a/CIyj8VI9WoOJgtOMt1aNuk2Kkr08Fz8rgRkyTQ3l6OUMMpClCN8H80hQiY4QdFu ycNxpZSHDerJlU5MYB22+cBdWe1RTPWI9q74HjRfqptTRJM0I4zVxKW7Mh3JOIpHog cjGYuz1vTzfX65jPUJC7AWmE0jpHYsigW4CX5y1o= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Heiko Carstens , Jarkko Sakkinen , Alexander Gordeev , Sasha Levin Subject: [PATCH 6.12 183/555] s390/cert_store: Do not search the process keyrings for the cert_store keyring Date: Fri, 4 Dec 2026 19:03:46 +0900 Message-ID: <20261204100615.148886035@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100603.988357525@linuxfoundation.org> References: <20261204100603.988357525@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 6.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Heiko Carstens [ Upstream commit 5ac71bb84e34337d7be280d2c06ff9cae77b7bcf ] find_cs_keyring() first searches the user session keyring for the cert_store keyring, and falls back to request_key(), which searches the thread, process and session keyrings of the calling task. Any keyring named "cert_store" found this way is accepted. cleanup_cs_keys() then invalidates and unlinks all of its keys, and clears and invalidates the keyring itself, without checking permissions. If the refresh is triggered by a task which inherited a session keyring that contains a keyring named "cert_store" not created by this code, this keyring and its keys are destroyed. create_cs_keyring() always links the keyring into the user session keyring, so the first search is sufficient. Remove the request_key() fallback. Fixes: 8cf57d7217c3 ("s390: add support for user-defined certificates") Signed-off-by: Heiko Carstens Reviewed-by: Jarkko Sakkinen Signed-off-by: Alexander Gordeev Signed-off-by: Sasha Levin --- arch/s390/kernel/cert_store.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/arch/s390/kernel/cert_store.c b/arch/s390/kernel/cert_store.c index 638095367c8bc..dd6e0f0e5b72b 100644 --- a/arch/s390/kernel/cert_store.c +++ b/arch/s390/kernel/cert_store.c @@ -353,7 +353,7 @@ static int invalidate_keyring_keys(struct key *keyring) static struct key *find_cs_keyring(void) { - struct key *cs_keyring, *us_keyring; + struct key *us_keyring; key_ref_t cs_keyring_ref; us_keyring = get_user_session_keyring(); @@ -366,11 +366,7 @@ static struct key *find_cs_keyring(void) if (!IS_ERR(cs_keyring_ref)) return key_ref_to_ptr(cs_keyring_ref); } - /* Search default locations: thread, process, session keyrings */ - cs_keyring = request_key(&key_type_keyring, CERT_STORE_KEYRING_NAME, NULL); - if (IS_ERR(cs_keyring)) - return NULL; - return cs_keyring; + return NULL; } static void cleanup_cs_keys(void) -- 2.53.0