coredump: 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-9-b447b82f2c9b@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner
2025-11-03 15:57:35 +01:00
parent af9803d4b8
commit 8ed3473c5a

View File

@@ -1155,7 +1155,6 @@ static void do_coredump(struct core_name *cn, struct coredump_params *cprm,
void vfs_coredump(const kernel_siginfo_t *siginfo)
{
struct cred *cred __free(put_cred) = NULL;
size_t *argv __free(kfree) = NULL;
struct core_state core_state;
struct core_name cn;
@@ -1183,7 +1182,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
if (coredump_skip(&cprm, binfmt))
return;
cred = prepare_creds();
CLASS(prepare_creds, cred)();
if (!cred)
return;
/*