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=1796381762; b=ZumFMImLUpYqHLEIJsMjLtb1CCnqv6kNgxjTDDYZwSBl28P5th0hyS4qdE10/IIUTaT9 JkL0/iHGviCFvuypMSJZLss01wS1jjLxW0+FBes/kDwvwfKgvvQwBkzRAHi/i868pmEjM CY5dM/xRfFCOBI+Mz0TzcMOTQXHhREMca/+G7e2VSUYnaGiAopcYtaIITx87JkZZ7jL11 PRFdkxtzfTshx383LRf3jjJhcc85GQeeofdxHaVWo3hBaeD1PdwHXZKfwE0TgaO23cdAC Tlw4IOxzg5T8HDR4oWQ8YBhBjB317FqiGxqd79LMzlTvLBMHrmMml8lcJnGzGVAQZ4A== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796381762; 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=zLiesvlgXawW6I03nh+Up2WCh1g9VR9YidaPMiKcMWA=; b=VMHI9pXJRmvoT77v6LzYUWzvCpO19ogxjjOHhu5cTexb0vB+AamaHpnloLDLpddLtU51 BB5CMjC3Fpw7xMDiXI3TjVTWPN88KUXgBU5PkvvGJ3SVQHnzF/S2Alj50kIE1Mf80advu B/Myxt/i3Iv2DQFvZMzcK11VQNyvOra6rema5AXUc5Iin0foAOgcYUtk9wFLZLRUpU6Do bTYytz7x6ANYCLZ9HWyPBShl3w//RkgYdBI0pj9yJPAYBnbF4CeumxQvjCjD+TKqPgtgP nsQHU+AF1gy7TkVgrVEH06Iv/A5RhzkYBS0EZ8R9jg15VYSg5x5KlLC/K83ZuQVwggA== 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=NRzSY1Pw; 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 057F5606A682; Fri, 4 Dec 2026 10:56:02 +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=NRzSY1Pw Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71FB41F00897; Fri, 4 Dec 2026 10:56:01 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796381761; bh=zLiesvlgXawW6I03nh+Up2WCh1g9VR9YidaPMiKcMWA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=NRzSY1PwWHMuvA1BjKC3/olATizAza0o9jIOZb8w3uxE2/VdFK7HTluxjCO94bcfa Rhl/jJKYtBp4lvPWtxolFzVAY2T6gs0Un8eCsBPbNT6ix5TMUrHTdbE11P6m1hMYiS sgbytF0oOjlYrLVEUBy79sLaRl/QVD1cAz/tyiFA= 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.18 162/703] s390/cert_store: Do not search the process keyrings for the cert_store keyring Date: Fri, 4 Dec 2026 19:01:01 +0900 Message-ID: <20261204100632.199415262@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100627.522266145@linuxfoundation.org> References: <20261204100627.522266145@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: patches@lists.linux.dev List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.18-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 444766e89c2db..8941ca3ad4841 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