coredump: auto cleanup prepare_creds()

which will allow us to simplify the exit path in further patches.

Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-20-315c0c34ba94@kernel.org
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2025-06-12 15:25:34 +02:00
parent 377d7860c9
commit 7a568fcdad
No known key found for this signature in database
GPG Key ID: 91C61BC06578DCA2

View File

@ -1074,7 +1074,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
struct mm_struct *mm = current->mm;
struct linux_binfmt * binfmt;
const struct cred *old_cred;
struct cred *cred;
struct cred *cred __free(put_cred) = NULL;
int retval = 0;
size_t *argv __free(kfree) = NULL;
int argc = 0;
@ -1113,7 +1113,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
retval = coredump_wait(siginfo->si_signo, &core_state);
if (retval < 0)
goto fail_creds;
return;
old_cred = override_creds(cred);
@ -1192,8 +1192,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
kfree(cn.corename);
coredump_finish(cn.core_dumped);
revert_creds(old_cred);
fail_creds:
put_cred(cred);
return;
}