summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSungjong Seo <sj1557.seo@samsung.com>2025-03-26 23:48:48 +0900
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-04-10 14:44:46 +0200
commitc467697de63cd1eff28b61b6024975544d8cfeb4 (patch)
treeb28ed21eccc5567f74f4363bac761d783258c2fc
parentf807a6bf2005740fa26b4f59c4a003dc966b9afd (diff)
downloadlinux-c467697de63cd1eff28b61b6024975544d8cfeb4.tar.gz
linux-c467697de63cd1eff28b61b6024975544d8cfeb4.tar.bz2
linux-c467697de63cd1eff28b61b6024975544d8cfeb4.zip
exfat: fix potential wrong error return from get_block
commit 59c30e31425833385e6644ad33151420e37eabe1 upstream. If there is no error, get_block() should return 0. However, when bh_read() returns 1, get_block() also returns 1 in the same manner. Let's set err to 0, if there is no error from bh_read() Fixes: 11a347fb6cef ("exfat: change to get file size from DataLength") Cc: stable@vger.kernel.org Signed-off-by: Sungjong Seo <sj1557.seo@samsung.com> Reviewed-by: Yuezhang Mo <Yuezhang.Mo@sony.com> Signed-off-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--fs/exfat/inode.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/exfat/inode.c b/fs/exfat/inode.c
index f3fdba9f4d21..a23677de4544 100644
--- a/fs/exfat/inode.c
+++ b/fs/exfat/inode.c
@@ -391,6 +391,8 @@ static int exfat_get_block(struct inode *inode, sector_t iblock,
/* Zero unwritten part of a block */
memset(bh_result->b_data + size, 0,
bh_result->b_size - size);
+
+ err = 0;
} else {
/*
* The range has not been written, clear the mapped flag