]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
exfat: fix i_blocks for files truncated over 4 GiB
authorChristophe Vu-Brugier <christophe.vu-brugier@seagate.com>
Mon, 22 Nov 2021 13:02:37 +0000 (22:02 +0900)
committerPaolo Pisati <paolo.pisati@canonical.com>
Wed, 9 Mar 2022 14:17:44 +0000 (15:17 +0100)
commit741ea7bfb1b88f89193308ef915265d0e8444845
tree08e64bbd6bc92487134efae2451ab9678be04830
parent6f829187826fa666e7bb3ef48f25ba3e9c5f4542
exfat: fix i_blocks for files truncated over 4 GiB

BugLink: https://bugs.launchpad.net/bugs/1964361
[ Upstream commit 92fba084b79e6bc7b12fc118209f1922c1a2df56 ]

In exfat_truncate(), the computation of inode->i_blocks is wrong if
the file is larger than 4 GiB because a 32-bit variable is used as a
mask. This is fixed and simplified by using round_up().

Also fix the same buggy computation in exfat_read_root() and another
(correct) one in exfat_fill_inode(). The latter was fixed another way
last month but can be simplified by using round_up() as well. See:

  commit 0c336d6e33f4 ("exfat: fix incorrect loading of i_blocks for
                        large files")

Fixes: 98d917047e8b ("exfat: add file operations")
Cc: stable@vger.kernel.org # v5.7+
Suggested-by: Matthew Wilcox <willy@infradead.org>
Reviewed-by: Sungjong Seo <sj1557.seo@samsung.com>
Signed-off-by: Christophe Vu-Brugier <christophe.vu-brugier@seagate.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
fs/exfat/file.c
fs/exfat/inode.c
fs/exfat/super.c