1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 07:53:11 -05:00

open: avoid pointless cred reference count bump

The code already got rid of the extra reference count from the old
version of override_creds().

Link: https://lore.kernel.org/r/20241125-work-cred-v2-17-68b9d38bb5b2@kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Reviewed-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Christian Brauner 2024-11-25 15:10:13 +01:00
parent 81be9a8a10
commit 7708f3a7d2
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2

View file

@ -402,7 +402,6 @@ static bool access_need_override_creds(int flags)
static const struct cred *access_override_creds(void)
{
const struct cred *old_cred;
struct cred *override_cred;
override_cred = prepare_creds();
@ -447,13 +446,7 @@ static const struct cred *access_override_creds(void)
* freeing.
*/
override_cred->non_rcu = 1;
old_cred = override_creds(get_new_cred(override_cred));
/* override_cred() gets its own ref */
put_cred(override_cred);
return old_cred;
return override_creds(override_cred);
}
static long do_faccessat(int dfd, const char __user *filename, int mode, int flags)