mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
ext4: always initialize the crc32c checksum driver [1/1]
PD#SWPL-15901
Problem:
OTT-6792
upstream a45403b515
The extended attribute code now uses the crc32c checksum for hashing
purposes, so we should just always always initialize it. We also want
to prevent NULL pointer dereferences if one of the metadata checksum
features is enabled after the file sytsem is originally mounted.
This issue has been assigned CVE-2018-1094.
https://bugzilla.kernel.org/show_bug.cgi?id=199183
https://bugzilla.redhat.com/show_bug.cgi?id=1560788
Solution:
Verify:
Change-Id: I30362945537ff4aa05fbf8e83dc52c25b3d24586
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Hanjie Lin <hanjie.lin@amlogic.com>
This commit is contained in:
@@ -2696,7 +2696,8 @@ static inline int ext4_has_metadata_csum(struct super_block *sb)
|
||||
WARN_ON_ONCE(ext4_has_feature_metadata_csum(sb) &&
|
||||
!EXT4_SB(sb)->s_chksum_driver);
|
||||
|
||||
return (EXT4_SB(sb)->s_chksum_driver != NULL);
|
||||
return ext4_has_feature_metadata_csum(sb) &&
|
||||
(EXT4_SB(sb)->s_chksum_driver != NULL);
|
||||
}
|
||||
static inline ext4_fsblk_t ext4_blocks_count(struct ext4_super_block *es)
|
||||
{
|
||||
|
||||
@@ -3461,14 +3461,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
|
||||
}
|
||||
|
||||
/* Load the checksum driver */
|
||||
if (ext4_has_feature_metadata_csum(sb)) {
|
||||
sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
|
||||
if (IS_ERR(sbi->s_chksum_driver)) {
|
||||
ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver.");
|
||||
ret = PTR_ERR(sbi->s_chksum_driver);
|
||||
sbi->s_chksum_driver = NULL;
|
||||
goto failed_mount;
|
||||
}
|
||||
sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
|
||||
if (IS_ERR(sbi->s_chksum_driver)) {
|
||||
ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver.");
|
||||
ret = PTR_ERR(sbi->s_chksum_driver);
|
||||
sbi->s_chksum_driver = NULL;
|
||||
goto failed_mount;
|
||||
}
|
||||
|
||||
/* Check superblock checksum */
|
||||
|
||||
Reference in New Issue
Block a user