add patch null-out-kobject-during-sysfs-cleanup
[ext4-patch-queue.git] / always-load-checksum-driver
blob8a90687511f6bcb7af89408a12d4c8728cfd00aa
1 ext4: always initialize the crc32c checksum driver
3 The extended attribute code now uses the crc32c checksum for hashing
4 purposes, so we should just always always initialize it.  We also want
5 to prevent NULL pointer dereferences if one of the metadata checksum
6 features is enabled after the file sytsem is originally mounted.
8 This issue has been assigned CVE-2018-1094.
10 https://bugzilla.kernel.org/show_bug.cgi?id=199183
11 https://bugzilla.redhat.com/show_bug.cgi?id=1560788
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 Cc: stable@vger.kernel.org
15 ---
16  fs/ext4/super.c | 15 ++++++---------
17  1 file changed, 6 insertions(+), 9 deletions(-)
19 diff --git a/fs/ext4/super.c b/fs/ext4/super.c
20 index 9d1da40c1f62..7cd022c344d1 100644
21 --- a/fs/ext4/super.c
22 +++ b/fs/ext4/super.c
23 @@ -3492,15 +3492,12 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent)
24         }
26         /* Load the checksum driver */
27 -       if (ext4_has_feature_metadata_csum(sb) ||
28 -           ext4_has_feature_ea_inode(sb)) {
29 -               sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
30 -               if (IS_ERR(sbi->s_chksum_driver)) {
31 -                       ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver.");
32 -                       ret = PTR_ERR(sbi->s_chksum_driver);
33 -                       sbi->s_chksum_driver = NULL;
34 -                       goto failed_mount;
35 -               }
36 +       sbi->s_chksum_driver = crypto_alloc_shash("crc32c", 0, 0);
37 +       if (IS_ERR(sbi->s_chksum_driver)) {
38 +               ext4_msg(sb, KERN_ERR, "Cannot load crc32c driver.");
39 +               ret = PTR_ERR(sbi->s_chksum_driver);
40 +               sbi->s_chksum_driver = NULL;
41 +               goto failed_mount;
42         }
44         /* Check superblock checksum */