Skip to content

Commit 76a4008

Browse files
committed
cachefiles: avoid pointless cred reference count bump
The cache holds a long-term reference to the credentials that's taken when the cache is created and put when the cache becomes unused. 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 9e8534f commit 76a4008

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

fs/cachefiles/internal.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,13 +393,13 @@ extern int cachefiles_determine_cache_security(struct cachefiles_cache *cache,
393393
static inline void cachefiles_begin_secure(struct cachefiles_cache *cache,
394394
const struct cred **_saved_cred)
395395
{
396-
*_saved_cred = override_creds(get_new_cred(cache->cache_cred));
396+
*_saved_cred = override_creds(cache->cache_cred);
397397
}
398398

399399
static inline void cachefiles_end_secure(struct cachefiles_cache *cache,
400400
const struct cred *saved_cred)
401401
{
402-
put_cred(revert_creds(saved_cred));
402+
revert_creds(saved_cred);
403403
}
404404

405405
/*

0 commit comments

Comments
 (0)