2016-11-23 00:24:14

by Daeho Jeong

[permalink] [raw]
Subject: [PATCH] ext4: fix inode checksum calculation problem of inode in some range of inode size

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 <[email protected]>
Signed-off-by: Daeho Jeong <[email protected]>
Signed-off-by: Youngjin Gil <[email protected]>
Signed-off-by: Darrick J. Wong <[email protected]>
---
fs/ext4/inode.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 9c06472..eaab3c3 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,
csum = ext4_chksum(sbi, csum, (__u8 *)&dummy_csum,
csum_size);
offset += csum_size;
- csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
- EXT4_INODE_SIZE(inode->i_sb) -
- offset);
}
+ csum = ext4_chksum(sbi, csum, (__u8 *)raw + offset,
+ EXT4_INODE_SIZE(inode->i_sb) - offset);
}

return csum;
--
1.7.9.5



2016-12-01 16:51:55

by Theodore Ts'o

[permalink] [raw]
Subject: Re: [PATCH] ext4: fix inode checksum calculation problem of inode in some range of inode size

On Wed, Nov 23, 2016 at 09:28:46AM +0900, Daeho Jeong wrote:
> 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 <[email protected]>
> Signed-off-by: Daeho Jeong <[email protected]>
> Signed-off-by: Youngjin Gil <[email protected]>
> Signed-off-by: Darrick J. Wong <[email protected]>

Thanks, applied.

- Ted