📄 ext3-sector_t-overflow-2.6.5-suse.patch
字号:
Subject: Avoid disk sector_t overflow for >2TB ext3 filesystemFrom: Mingming Cao <cmm@us.ibm.com>If ext3 filesystem is larger than 2TB, and sector_t is a u32 (i.e. CONFIG_LBD not defined in the kernel), the calculation of the disk sectorwill overflow. Add check at ext3_fill_super() and ext3_group_extend() toprevent mount/remount/resize >2TB ext3 filesystem if sector_t size is 4bytes.Verified this patch on a 32 bit platform without CONFIG_LBD defined(sector_t is 32 bits long), mount refuse to mount a 10TB ext3.Signed-off-by: Mingming Cao<cmm@us.ibm.com>Acked-by: Andreas Dilger <adilger@clusterfs.com>Signed-off-by: Andrew Morton <akpm@osdl.org>--- fs/ext3/resize.c | 10 ++++++++++ fs/ext3/super.c | 10 ++++++++++ 2 files changed, 20 insertions(+)diff -puN fs/ext3/super.c~avoid-disk-sector_t-overflow-for-2tb-ext3-filesystem fs/ext3/super.c--- devel/fs/ext3/super.c~avoid-disk-sector_t-overflow-for-2tb-ext3-filesystem 2006-05-22 14:09:53.000000000 -0700+++ devel-akpm/fs/ext3/super.c 2006-05-22 14:11:10.000000000 -0700@@ -1565,6 +1565,17 @@ static int ext3_fill_super (struct super goto failed_mount; } + if (le32_to_cpu(es->s_blocks_count) >+ (sector_t)(~0ULL) >> (sb->s_blocksize_bits - 9)) {+ printk(KERN_ERR "EXT3-fs: filesystem on %s: "+ "too large to mount safely - %u blocks\n", sb->s_id,+ le32_to_cpu(es->s_blocks_count));+ if (sizeof(sector_t) < 8)+ printk(KERN_WARNING+ "EXT3-fs: CONFIG_LBD not enabled\n");+ goto failed_mount;+ }+ sbi->s_groups_count = (le32_to_cpu(es->s_blocks_count) - le32_to_cpu(es->s_first_data_block) + EXT3_BLOCKS_PER_GROUP(sb) - 1) /_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -