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)
committerNamjae Jeon <linkinjeon@kernel.org>
Wed, 5 Mar 2025 12:53:20 +0000 (21:53 +0900)
commitfda94a9919fd632033979ad7765a99ae3cab9289
treea81abf0d5590179ae4e971bf95a86d0b5f0d906a
parent9da33619e0ca53627641bc97d1b93ec741299111
exfat: short-circuit zero-byte writes in exfat_file_write_iter

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>
fs/exfat/file.c