Skip to content

Commit 7708f3a

Browse files
committed
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/[email protected] Reviewed-by: Jeff Layton <[email protected]> Reviewed-by: Jens Axboe <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 81be9a8 commit 7708f3a

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

fs/open.c

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,6 @@ static bool access_need_override_creds(int flags)
402402

403403
static const struct cred *access_override_creds(void)
404404
{
405-
const struct cred *old_cred;
406405
struct cred *override_cred;
407406

408407
override_cred = prepare_creds();
@@ -447,13 +446,7 @@ static const struct cred *access_override_creds(void)
447446
* freeing.
448447
*/
449448
override_cred->non_rcu = 1;
450-
451-
old_cred = override_creds(get_new_cred(override_cred));
452-
453-
/* override_cred() gets its own ref */
454-
put_cred(override_cred);
455-
456-
return old_cred;
449+
return override_creds(override_cred);
457450
}
458451

459452
static long do_faccessat(int dfd, const char __user *filename, int mode, int flags)

0 commit comments

Comments
 (0)