diff options
| author | Daeho Jeong <daeho.jeong@samsung.com> | 2016-12-01 11:49:12 -0500 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2017-04-21 03:31:23 -0400 |
| commit | b1574caf96642113d1507ec637cc986acc4b61af (patch) | |
| tree | 268d2f0af1134592f9413497fc8fadb5f69a15b4 /fs | |
| parent | 1992564156b5dc4ac73418e5b95e1a43f12f3cb1 (diff) | |
ext4: fix inode checksum calculation problem if i_extra_size is small
commit 05ac5aa18abd7db341e54df4ae2b4c98ea0e43b7 upstream.
We've fixed the race condition problem in calculating ext4 checksum
value in commit b47820edd163 ("ext4: avoid modifying checksum fields
directly during checksum veficationon"). However, by this change,
when calculating the checksum value of inode whose i_extra_size is
less than 4, we couldn't calculate the checksum value in a proper way.
This problem was found and reported by Nix, Thank you.
Reported-by: Nix <nix@esperi.org.uk>
Signed-off-by: Daeho Jeong <daeho.jeong@samsung.com>
Signed-off-by: Youngjin Gil <youngjin.gil@samsung.com>
Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
| -rw-r--r-- | fs/ext4/inode.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c index dc9d64ac5969..c78fce404654 100644 --- a/fs/ext4/inode.c +++ b/fs/ext4/inode.c | |||
| @@ -71,10 +71,9 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw, | |||
| 71 | csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, | 71 | csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum, |
| 72 | csum_size); | 72 | csum_size); |
| 73 | offset += csum_size; | 73 | offset += csum_size; |
| 74 | csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset, | ||
| 75 | EXT4_INODE_SIZE(inode->i_sb) - | ||
| 76 | offset); | ||
| 77 | } | 74 | } |
| 75 | csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset, | ||
| 76 | EXT4_INODE_SIZE(inode->i_sb) - offset); | ||
| 78 | } | 77 | } |
| 79 | 78 | ||
| 80 | return csum; | 79 | return csum; |
