summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2024-11-25 15:10:08 +0100
committerChristian Brauner <brauner@kernel.org>2024-12-02 11:25:11 +0100
commitbd05aeb1eedc60dee05f82efe97339330239f37e (patch)
tree60933b057c27a778e4edab8ddf51d8d32b9ceade
parentcaf6bf48f902e8e353f124325dd635d143331476 (diff)
coredump: avoid pointless cred reference count bump
The creds are allocated via prepare_creds() which has already taken a reference. Link: https://lore.kernel.org/r/20241125-work-cred-v2-12-68b9d38bb5b2@kernel.org Reviewed-by: Jeff Layton <jlayton@kernel.org> Reviewed-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Christian Brauner <brauner@kernel.org>
-rw-r--r--fs/coredump.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/coredump.c b/fs/coredump.c
index 0d3a65cac546..d48edb37bc35 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -576,7 +576,7 @@ void do_coredump(const kernel_siginfo_t *siginfo)
if (retval < 0)
goto fail_creds;
- old_cred = override_creds(get_new_cred(cred));
+ old_cred = override_creds(cred);
ispipe = format_corename(&cn, &cprm, &argv, &argc);
@@ -781,7 +781,7 @@ fail_unlock:
kfree(argv);
kfree(cn.corename);
coredump_finish(core_dumped);
- put_cred(revert_creds(old_cred));
+ revert_creds(old_cred);
fail_creds:
put_cred(cred);
fail: