Skip to content

Commit 377d786

Browse files
committed
cred: add auto cleanup method
Add a simple auto cleanup method for struct cred. Link: https://lore.kernel.org/20250612-work-coredump-massage-v1-19-315c0c34ba94@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
1 parent 8434fac commit 377d786

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

include/linux/cred.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,8 @@ static inline void put_cred(const struct cred *cred)
263263
put_cred_many(cred, 1);
264264
}
265265

266+
DEFINE_FREE(put_cred, struct cred *, if (!IS_ERR_OR_NULL(_T)) put_cred(_T))
267+
266268
/**
267269
* current_cred - Access the current task's subjective credentials
268270
*

0 commit comments

Comments
 (0)