For the v6.13 cycle we switched overlayfs to a variant of override_creds() that doesn't take an extra reference. To this end I suggested introducing {override,revert}_creds_light() which overlayfs could use. This seems to work rather well. As Linus correctly points out that we should look into unifying both and simply make {override,revert}_creds() do what {override,revert}_creds_light() currently does. Caller's that really need the extra reference count can take it manually. This series does all that. Afaict, most callers can be directly converted over and can avoid the extra reference count completely. Lightly tested. --- Christian Brauner (26): tree-wide: s/override_creds()/override_creds_light(get_new_cred())/g cred: return old creds from revert_creds_light() tree-wide: s/revert_creds()/put_cred(revert_creds_light())/g cred: remove old {override,revert}_creds() helpers tree-wide: s/override_creds_light()/override_creds()/g tree-wide: s/revert_creds_light()/revert_creds()/g firmware: avoid pointless reference count bump sev-dev: avoid pointless cred reference count bump target_core_configfs: avoid pointless cred reference count bump aio: avoid pointless cred reference count bump binfmt_misc: avoid pointless cred reference count bump coredump: avoid pointless cred reference count bump nfs/localio: avoid pointless cred reference count bumps nfs/nfs4idmap: avoid pointless reference count bump nfs/nfs4recover: avoid pointless cred reference count bump nfsfh: avoid pointless cred reference count bump open: avoid pointless cred reference count bump ovl: avoid pointless cred reference count bump cifs: avoid pointless cred reference count bump cifs: avoid pointless cred reference count bump smb: avoid pointless cred reference count bump io_uring: avoid pointless cred reference count bump acct: avoid pointless reference count bump cgroup: avoid pointless cred reference count bump trace: avoid pointless cred reference count bump dns_resolver: avoid pointless cred reference count bump drivers/base/firmware_loader/main.c | 3 +-- drivers/crypto/ccp/sev-dev.c | 2 +- drivers/target/target_core_configfs.c | 3 +-- fs/aio.c | 3 +-- fs/backing-file.c | 20 +++++++------- fs/cachefiles/internal.h | 4 +-- fs/nfsd/auth.c | 4 +-- fs/nfsd/filecache.c | 2 +- fs/nfsd/nfs4recover.c | 3 +-- fs/nfsd/nfsfh.c | 1 - fs/open.c | 10 ++----- fs/overlayfs/copy_up.c | 6 ++--- fs/overlayfs/dir.c | 4 +-- fs/overlayfs/util.c | 4 +-- fs/smb/server/smb_common.c | 4 +-- include/linux/cred.h | 14 ++++------ kernel/cred.c | 50 ----------------------------------- kernel/trace/trace_events_user.c | 3 +-- 18 files changed, 35 insertions(+), 105 deletions(-) --- base-commit: 228a1157fb9fec47eb135b51c0202b574e079ebf change-id: 20241124-work-cred-349b65450082