Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

sev-dev: use prepare credential guard

Use the prepare credential guard for allocating a new set of
credentials.

Link: https://patch.msgid.link/20251103-work-creds-guards-prepare_creds-v1-3-b447b82f2c9b@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>

+3 -3
+3 -3
drivers/crypto/ccp/sev-dev.c
··· 261 261 { 262 262 struct path root __free(path_put) = {}; 263 263 struct file *fp; 264 - struct cred *cred; 265 264 const struct cred *old_cred; 266 265 267 266 task_lock(&init_task); 268 267 get_fs_root(init_task.fs, &root); 269 268 task_unlock(&init_task); 270 269 271 - cred = prepare_creds(); 270 + CLASS(prepare_creds, cred)(); 272 271 if (!cred) 273 272 return ERR_PTR(-ENOMEM); 273 + 274 274 cred->fsuid = GLOBAL_ROOT_UID; 275 275 old_cred = override_creds(cred); 276 276 277 277 fp = file_open_root(&root, filename, flags, mode); 278 278 279 - put_cred(revert_creds(old_cred)); 279 + revert_creds(old_cred); 280 280 281 281 return fp; 282 282 }