]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
exfat: short-circuit zero-byte writes in exfat_file_write_iter
authorEric Sandeen <sandeen@redhat.com>
Tue, 11 Feb 2025 20:14:21 +0000 (14:14 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:08 +0000 (13:02 +0100)
commit611015122d18e1f45647ecfc406fcb097b86cb77
tree33585c21d80ec7507974023c6dcc21360a83ec4a
parentc897b8ec46785e275db8a87c974d8b45c1892ad9
exfat: short-circuit zero-byte writes in exfat_file_write_iter

[ Upstream commit fda94a9919fd632033979ad7765a99ae3cab9289 ]

When generic_write_checks() returns zero, it means that
iov_iter_count() is zero, and there is no work to do.

Simply return success like all other filesystems do, rather than
proceeding down the write path, which today yields an -EFAULT in
generic_perform_write() via the
(fault_in_iov_iter_readable(i, bytes) == bytes) check when bytes
== 0.

Fixes: 11a347fb6cef ("exfat: change to get file size from DataLength")
Reported-by: Noah <kernel-org-10@maxgrass.eu>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/exfat/file.c