Skip to content

Commit e42ee56

Browse files
committed
Merge tag 'for-5.11-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux
Pull btrfs fix from David Sterba: "A regression fix caused by a refactoring in 5.11. A corrupted superblock wouldn't be detected by checksum verification due to wrongly placed initialization of the checksum length, thus making memcmp always work" * tag 'for-5.11-rc7-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux: btrfs: initialize fs_info::csum_size earlier in open_ctree
2 parents 7989807 + 83c68bb commit e42ee56

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

fs/btrfs/disk-io.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3044,6 +3044,8 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
30443044
goto fail_alloc;
30453045
}
30463046

3047+
fs_info->csum_size = btrfs_super_csum_size(disk_super);
3048+
30473049
ret = btrfs_init_csum_hash(fs_info, csum_type);
30483050
if (ret) {
30493051
err = ret;
@@ -3161,7 +3163,6 @@ int __cold open_ctree(struct super_block *sb, struct btrfs_fs_devices *fs_device
31613163
fs_info->nodesize = nodesize;
31623164
fs_info->sectorsize = sectorsize;
31633165
fs_info->sectorsize_bits = ilog2(sectorsize);
3164-
fs_info->csum_size = btrfs_super_csum_size(disk_super);
31653166
fs_info->csums_per_leaf = BTRFS_MAX_ITEM_SIZE(fs_info) / fs_info->csum_size;
31663167
fs_info->stripesize = stripesize;
31673168

0 commit comments

Comments
 (0)