[PATCH 09/12] coredump: use prepare credential guard

Christian Brauner brauner at kernel.org
Tue Nov 4 01:57:35 AEDT 2025


Use the prepare credential guard for allocating a new set of
credentials.

Signed-off-by: Christian Brauner <brauner at kernel.org>
---
 fs/coredump.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/fs/coredump.c b/fs/coredump.c
index 79c681f1d647..5424a6c4e360 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -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;
 	/*

-- 
2.47.3



More information about the Linux-erofs mailing list