From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-aio@kvack.org, linux-unionfs@vger.kernel.org,
linux-erofs@lists.ozlabs.org, linux-nfs@vger.kernel.org,
linux-cifs@vger.kernel.org, samba-technical@lists.samba.org,
cgroups@vger.kernel.org, netdev@vger.kernel.org,
linux-crypto@vger.kernel.org,
linux-trace-kernel@vger.kernel.org,
Christian Brauner <brauner@kernel.org>
Subject: [PATCH 03/12] sev-dev: use prepare credential guard
Date: Mon, 03 Nov 2025 15:57:29 +0100 [thread overview]
Message-ID: <20251103-work-creds-guards-prepare_creds-v1-3-b447b82f2c9b@kernel.org> (raw)
In-Reply-To: <20251103-work-creds-guards-prepare_creds-v1-0-b447b82f2c9b@kernel.org>
Use the prepare credential guard for allocating a new set of
credentials.
Signed-off-by: Christian Brauner <brauner@kernel.org>
---
drivers/crypto/ccp/sev-dev.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/crypto/ccp/sev-dev.c b/drivers/crypto/ccp/sev-dev.c
index c5e22af04abb..09e4c9490d58 100644
--- a/drivers/crypto/ccp/sev-dev.c
+++ b/drivers/crypto/ccp/sev-dev.c
@@ -268,15 +268,16 @@ static struct file *open_file_as_root(const char *filename, int flags, umode_t m
get_fs_root(init_task.fs, &root);
task_unlock(&init_task);
- cred = prepare_creds();
+ CLASS(prepare_creds, cred)();
if (!cred)
return ERR_PTR(-ENOMEM);
+
cred->fsuid = GLOBAL_ROOT_UID;
old_cred = override_creds(cred);
fp = file_open_root(&root, filename, flags, mode);
- put_cred(revert_creds(old_cred));
+ revert_creds(old_cred);
return fp;
}
--
2.47.3
next prev parent reply other threads:[~2025-11-03 14:57 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-03 14:57 [PATCH 00/12] credential guards: credential preparation Christian Brauner
2025-11-03 14:57 ` [PATCH 01/12] cred: add prepare credential guard Christian Brauner
2025-11-03 14:57 ` [PATCH 02/12] sev-dev: use guard for path Christian Brauner
2025-11-03 14:57 ` Christian Brauner [this message]
2025-11-03 14:57 ` [PATCH 04/12] sev-dev: use override credential guards Christian Brauner
2025-11-03 14:57 ` [PATCH 05/12] coredump: move revert_cred() before coredump_cleanup() Christian Brauner
2025-11-03 14:57 ` [PATCH 06/12] coredump: pass struct linux_binfmt as const Christian Brauner
2025-11-03 14:57 ` [PATCH 07/12] coredump: mark struct mm_struct " Christian Brauner
2025-11-03 14:57 ` [PATCH 08/12] coredump: split out do_coredump() from vfs_coredump() Christian Brauner
2025-11-03 14:57 ` [PATCH 09/12] coredump: use prepare credential guard Christian Brauner
2025-11-03 14:57 ` [PATCH 10/12] coredump: use override " Christian Brauner
2025-11-03 14:57 ` [PATCH 11/12] trace: use prepare " Christian Brauner
2025-11-03 16:09 ` Steven Rostedt
2025-11-03 14:57 ` [PATCH 12/12] trace: use override " Christian Brauner
2025-11-03 16:10 ` Steven Rostedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20251103-work-creds-guards-prepare_creds-v1-3-b447b82f2c9b@kernel.org \
--to=brauner@kernel.org \
--cc=cgroups@vger.kernel.org \
--cc=linux-aio@kvack.org \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-trace-kernel@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=samba-technical@lists.samba.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).