1 ext4: fix inode checksum calculation problem if i_extra_size is small
3 From: Daeho Jeong <daeho.jeong@samsung.com>
5 We've fixed the race condition problem in calculating ext4 checksum
6 value in commit b47820edd163 ("ext4: avoid modifying checksum fields
7 directly during checksum veficationon"). However, by this change,
8 when calculating the checksum value of inode whose i_extra_size is
9 less than 4, we couldn't calculate the checksum value in a proper way.
10 This problem was found and reported by Nix, Thank you.
12 Reported-by: Nix <nix@esperi.org.uk>
13 Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
14 Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
15 Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
16 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
18 fs/ext4/inode.c | 5 ++---
19 1 file changed, 2 insertions(+), 3 deletions(-)
21 diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
22 index 9c06472..eaab3c3 100644
25 @@ -71,10 +71,9 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
26 csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum,
29 - csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
30 - EXT4_INODE_SIZE(inode->i_sb) -
33 + csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
34 + EXT4_INODE_SIZE(inode->i_sb) - offset);