From: Christian Brauner Date: Mon, 25 Nov 2024 14:10:06 +0000 (+0100) Subject: aio: avoid pointless cred reference count bump X-Git-Tag: v6.14-rc1~214^2~1^2~19 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=b37eab47cf5479f974c029e23d84f9049d4df009;p=thirdparty%2Fkernel%2Flinux.git aio: avoid pointless cred reference count bump iocb->fsync.creds already holds a reference count that is stable while the operation is performed. Link: https://lore.kernel.org/r/20241125-work-cred-v2-10-68b9d38bb5b2@kernel.org Reviewed-by: Jeff Layton Reviewed-by: Jens Axboe Signed-off-by: Christian Brauner --- diff --git a/fs/aio.c b/fs/aio.c index 5e57dcaed7f1a..50671640b5883 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -1639,10 +1639,10 @@ static int aio_write(struct kiocb *req, const struct iocb *iocb, static void aio_fsync_work(struct work_struct *work) { struct aio_kiocb *iocb = container_of(work, struct aio_kiocb, fsync.work); - const struct cred *old_cred = override_creds(get_new_cred(iocb->fsync.creds)); + const struct cred *old_cred = override_creds(iocb->fsync.creds); iocb->ki_res.res = vfs_fsync(iocb->fsync.file, iocb->fsync.datasync); - put_cred(revert_creds(old_cred)); + revert_creds(old_cred); put_cred(iocb->fsync.creds); iocb_put(iocb); }