summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorEric Sandeen <sandeen@redhat.com>2025-02-11 14:14:21 -0600
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-03-13 13:07:58 +0100
commit0d90a34c9b86af13b548d4cb102149e50a4dcc8f (patch)
treec360ca402211d7353625b831de3b7e826b6121c7 /fs
parent71ceb478c8ea212dc188602c33d5b382d0bce969 (diff)
downloadlinux-0d90a34c9b86af13b548d4cb102149e50a4dcc8f.tar.gz
linux-0d90a34c9b86af13b548d4cb102149e50a4dcc8f.tar.bz2
linux-0d90a34c9b86af13b548d4cb102149e50a4dcc8f.zip
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>
Diffstat (limited to 'fs')
-rw-r--r--fs/exfat/file.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/exfat/file.c b/fs/exfat/file.c
index 05b51e721783..807349d8ea05 100644
--- a/fs/exfat/file.c
+++ b/fs/exfat/file.c
@@ -587,7 +587,7 @@ static ssize_t exfat_file_write_iter(struct kiocb *iocb, struct iov_iter *iter)
valid_size = ei->valid_size;
ret = generic_write_checks(iocb, iter);
- if (ret < 0)
+ if (ret <= 0)
goto unlock;
if (iocb->ki_flags & IOCB_DIRECT) {