Skip to content

Commit 7a568fc

Browse files
committed
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>
1 parent 377d786 commit 7a568fc

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

fs/coredump.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1074,7 +1074,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
10741074
struct mm_struct *mm = current->mm;
10751075
struct linux_binfmt * binfmt;
10761076
const struct cred *old_cred;
1077-
struct cred *cred;
1077+
struct cred *cred __free(put_cred) = NULL;
10781078
int retval = 0;
10791079
size_t *argv __free(kfree) = NULL;
10801080
int argc = 0;
@@ -1113,7 +1113,7 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
11131113

11141114
retval = coredump_wait(siginfo->si_signo, &core_state);
11151115
if (retval < 0)
1116-
goto fail_creds;
1116+
return;
11171117

11181118
old_cred = override_creds(cred);
11191119

@@ -1192,8 +1192,6 @@ void vfs_coredump(const kernel_siginfo_t *siginfo)
11921192
kfree(cn.corename);
11931193
coredump_finish(cn.core_dumped);
11941194
revert_creds(old_cred);
1195-
fail_creds:
1196-
put_cred(cred);
11971195
return;
11981196
}
11991197

0 commit comments

Comments
 (0)