summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorChristian Brauner <brauner@kernel.org>2025-11-03 22:42:45 +0100
committerChristian Brauner <brauner@kernel.org>2025-11-04 12:36:53 +0100
commita85787996aa97412223ff1975f5cd44b592e2f5f (patch)
treec9fc500f9b62028bb03175b6bcae8075ad5c2b30 /include/linux
parente0876bde29c42c5de8ad087b5df7cd27b29defec (diff)
parent4037e28cd47e5a860ea23214024bcbe8a7585d81 (diff)
Merge patch series "credentials guards: the easy cases"
Christian Brauner <brauner@kernel.org> says: This converts all users of override_creds() to rely on credentials guards. Leave all those that do the prepare_creds() + modify creds + override_creds() dance alone for now. Some of them qualify for their own variant. * patches from https://patch.msgid.link/20251103-work-creds-guards-simple-v1-0-a3e156839e7f@kernel.org: net/dns_resolver: use credential guards in dns_query() cgroup: use credential guards in cgroup_attach_permissions() act: use credential guards in acct_write_process() smb: use credential guards in cifs_get_spnego_key() nfs: use credential guards in nfs_idmap_get_key() nfs: use credential guards in nfs_local_call_write() nfs: use credential guards in nfs_local_call_read() erofs: use credential guards binfmt_misc: use credential guards backing-file: use credential guards for mmap backing-file: use credential guards for splice write backing-file: use credential guards for splice read backing-file: use credential guards for writes backing-file: use credential guards for reads aio: use credential guards cred: add {scoped_}with_creds() guards Link: https://patch.msgid.link/20251103-work-creds-guards-simple-v1-0-a3e156839e7f@kernel.org Signed-off-by: Christian Brauner <brauner@kernel.org>
Diffstat (limited to 'include/linux')
-rw-r--r--include/linux/cred.h6
1 files changed, 4 insertions, 2 deletions
diff --git a/include/linux/cred.h b/include/linux/cred.h
index be2cd07b174c..6ea2d81a740b 100644
--- a/include/linux/cred.h
+++ b/include/linux/cred.h
@@ -192,8 +192,10 @@ DEFINE_CLASS(override_creds,
revert_creds(_T),
override_creds(override_cred), const struct cred *override_cred)
-#define scoped_with_kernel_creds() \
- scoped_class(override_creds, __UNIQUE_ID(cred), kernel_cred())
+#define scoped_with_creds(cred) \
+ scoped_class(override_creds, __UNIQUE_ID(label), cred)
+
+#define scoped_with_kernel_creds() scoped_with_creds(kernel_cred())
/**
* get_cred_many - Get references on a set of credentials