diff options
| author | Christian Brauner <brauner@kernel.org> | 2025-06-12 16:25:33 +0300 |
|---|---|---|
| committer | Christian Brauner <brauner@kernel.org> | 2025-07-07 13:24:50 +0300 |
| commit | 377d7860c960ac8e672881bc50353d867e2f94a4 (patch) | |
| tree | 35616ec77a466952f659783a778ce580319a9c7b /include/linux | |
| parent | 8434fac512d35597488b13e23cc85e2903f5c8ae (diff) | |
| download | linux-377d7860c960ac8e672881bc50353d867e2f94a4.tar.xz | |
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>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/cred.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/include/linux/cred.h b/include/linux/cred.h index 5658a3bfe803..a102a10f833f 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -263,6 +263,8 @@ static inline void put_cred(const struct cred *cred) put_cred_many(cred, 1); } +DEFINE_FREE(put_cred, struct cred *, if (!IS_ERR_OR_NULL(_T)) put_cred(_T)) + /** * current_cred - Access the current task's subjective credentials * |
