mirror of
https://github.com/torvalds/linux.git
synced 2026-05-28 09:04:39 +02:00
coredump: use override credential guard
Use override credential guards for scoped credential override with automatic restoration on scope exit. Link: https://patch.msgid.link/20251103-work-creds-guards-prepare_creds-v1-10-b447b82f2c9b@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
parent
8ed3473c5a
commit
545985dd37
|
|
@ -1160,7 +1160,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
|
|||
struct core_name cn;
|
||||
const struct mm_struct *mm = current->mm;
|
||||
const struct linux_binfmt *binfmt = mm->binfmt;
|
||||
const struct cred *old_cred;
|
||||
int argc = 0;
|
||||
struct coredump_params cprm = {
|
||||
.siginfo = siginfo,
|
||||
|
|
@ -1197,11 +1196,8 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
|
|||
if (coredump_wait(siginfo->si_signo, &core_state) < 0)
|
||||
return;
|
||||
|
||||
old_cred = override_creds(cred);
|
||||
|
||||
do_coredump(&cn, &cprm, &argv, &argc, binfmt);
|
||||
|
||||
revert_creds(old_cred);
|
||||
scoped_with_creds(cred)
|
||||
do_coredump(&cn, &cprm, &argv, &argc, binfmt);
|
||||
coredump_cleanup(&cn, &cprm);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user