]> www.infradead.org Git - users/hch/misc.git/commitdiff
exfat: fix potential wrong error return from get_block
authorSungjong Seo <sj1557.seo@samsung.com>
Wed, 26 Mar 2025 14:48:48 +0000 (23:48 +0900)
committerNamjae Jeon <linkinjeon@kernel.org>
Sat, 29 Mar 2025 13:03:07 +0000 (22:03 +0900)
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>
fs/exfat/inode.c

index f3fdba9f4d21a343c4383282835e17d446f8b2d4..a23677de4544f34c1e8e76e569ab7b649aac7bb0 100644 (file)
@@ -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