* FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree @ 2018-07-30 7:58 gregkh 2018-08-05 21:25 ` Sudip Mukherjee 0 siblings, 1 reply; 5+ messages in thread From: gregkh @ 2018-07-30 7:58 UTC (permalink / raw) To: tytso; +Cc: stable The patch below does not apply to the 4.14-stable tree. If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <stable@vger.kernel.org>. thanks, greg k-h ------------------ original commit in Linus's tree ------------------ >From 44de022c4382541cebdd6de4465d1f4f465ff1dd Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Sun, 8 Jul 2018 19:35:02 -0400 Subject: [PATCH] ext4: fix false negatives *and* false positives in ext4_check_descriptors() Ext4_check_descriptors() was getting called before s_gdb_count was initialized. So for file systems w/o the meta_bg feature, allocation bitmaps could overlap the block group descriptors and ext4 wouldn't notice. For file systems with the meta_bg feature enabled, there was a fencepost error which would cause the ext4_check_descriptors() to incorrectly believe that the block allocation bitmap overlaps with the block group descriptor blocks, and it would reject the mount. Fix both of these problems. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org diff --git a/fs/ext4/super.c b/fs/ext4/super.c index ba2396a7bd04..eff5c983e067 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2342,7 +2342,7 @@ static int ext4_check_descriptors(struct super_block *sb, struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); ext4_fsblk_t last_block; - ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1; + ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0); ext4_fsblk_t block_bitmap; ext4_fsblk_t inode_bitmap; ext4_fsblk_t inode_table; @@ -4085,14 +4085,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount2; } } + sbi->s_gdb_count = db_count; if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); ret = -EFSCORRUPTED; goto failed_mount2; } - sbi->s_gdb_count = db_count; - timer_setup(&sbi->s_err_report, print_daily_error_info, 0); /* Register extent status tree shrinker */ ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree 2018-07-30 7:58 FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree gregkh @ 2018-08-05 21:25 ` Sudip Mukherjee 2018-08-06 13:40 ` Theodore Y. Ts'o 2018-08-07 13:15 ` Greg KH 0 siblings, 2 replies; 5+ messages in thread From: Sudip Mukherjee @ 2018-08-05 21:25 UTC (permalink / raw) To: gregkh; +Cc: tytso, stable [-- Attachment #1: Type: text/plain, Size: 410 bytes --] Hi Greg, On Mon, Jul 30, 2018 at 09:58:27AM +0200, gregkh@linuxfoundation.org wrote: > > The patch below does not apply to the 4.14-stable tree. > If someone wants it applied there, or to any other stable or longterm > tree, then please email the backport, including the original git commit > id to <stable@vger.kernel.org>. The attached backported patch should apply to 4.14-stable tree. -- Regards Sudip [-- Attachment #2: 0003-ext4-fix-false-negatives-and-false-positives-in-ext4.patch --] [-- Type: text/x-diff, Size: 2083 bytes --] >From 6a6ec4cab0f949122667580a97fa32539cbc128c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Sun, 8 Jul 2018 19:35:02 -0400 Subject: [PATCH] ext4: fix false negatives *and* false positives in ext4_check_descriptors() commit 44de022c4382541cebdd6de4465d1f4f465ff1dd upstream Ext4_check_descriptors() was getting called before s_gdb_count was initialized. So for file systems w/o the meta_bg feature, allocation bitmaps could overlap the block group descriptors and ext4 wouldn't notice. For file systems with the meta_bg feature enabled, there was a fencepost error which would cause the ext4_check_descriptors() to incorrectly believe that the block allocation bitmap overlaps with the block group descriptor blocks, and it would reject the mount. Fix both of these problems. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> --- fs/ext4/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6b0c1ea95196..f30d2bf40471 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2301,7 +2301,7 @@ static int ext4_check_descriptors(struct super_block *sb, struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); ext4_fsblk_t last_block; - ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1; + ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0); ext4_fsblk_t block_bitmap; ext4_fsblk_t inode_bitmap; ext4_fsblk_t inode_table; @@ -4038,13 +4038,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount2; } } + sbi->s_gdb_count = db_count; if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); ret = -EFSCORRUPTED; goto failed_mount2; } - sbi->s_gdb_count = db_count; get_random_bytes(&sbi->s_next_generation, sizeof(u32)); spin_lock_init(&sbi->s_next_gen_lock); -- 2.11.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree 2018-08-05 21:25 ` Sudip Mukherjee @ 2018-08-06 13:40 ` Theodore Y. Ts'o 2018-08-07 2:30 ` Theodore Y. Ts'o 2018-08-07 13:15 ` Greg KH 1 sibling, 1 reply; 5+ messages in thread From: Theodore Y. Ts'o @ 2018-08-06 13:40 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: gregkh, stable On Sun, Aug 05, 2018 at 10:25:22PM +0100, Sudip Mukherjee wrote: > Hi Greg, > > On Mon, Jul 30, 2018 at 09:58:27AM +0200, gregkh@linuxfoundation.org wrote: > > > > The patch below does not apply to the 4.14-stable tree. > > If someone wants it applied there, or to any other stable or longterm > > tree, then please email the backport, including the original git commit > > id to <stable@vger.kernel.org>. > > The attached backported patch should apply to 4.14-stable tree. Thanks Sudip! Acked-by: Theodore Ts'o <tytso@mit.edu> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree 2018-08-06 13:40 ` Theodore Y. Ts'o @ 2018-08-07 2:30 ` Theodore Y. Ts'o 0 siblings, 0 replies; 5+ messages in thread From: Theodore Y. Ts'o @ 2018-08-07 2:30 UTC (permalink / raw) To: gregkh, Sudip Mukherjee; +Cc: stable [-- Attachment #1: Type: text/plain, Size: 744 bytes --] On Mon, Aug 06, 2018 at 09:40:04AM -0400, Theodore Y. Ts'o wrote: > On Sun, Aug 05, 2018 at 10:25:22PM +0100, Sudip Mukherjee wrote: > > Hi Greg, > > > > On Mon, Jul 30, 2018 at 09:58:27AM +0200, gregkh@linuxfoundation.org wrote: > > > > > > The patch below does not apply to the 4.14-stable tree. > > > If someone wants it applied there, or to any other stable or longterm > > > tree, then please email the backport, including the original git commit > > > id to <stable@vger.kernel.org>. > > > > The attached backported patch should apply to 4.14-stable tree. > > Thanks Sudip! > > Acked-by: Theodore Ts'o <tytso@mit.edu> Greg, can you also make sure this patch gets applied to the 4.4 and 4.9 stable trees? Many thanks! - Ted [-- Attachment #2: 0003-ext4-fix-false-negatives-and-false-positives-in-ext4.patch --] [-- Type: text/x-diff, Size: 2083 bytes --] >From 6a6ec4cab0f949122667580a97fa32539cbc128c Mon Sep 17 00:00:00 2001 From: Theodore Ts'o <tytso@mit.edu> Date: Sun, 8 Jul 2018 19:35:02 -0400 Subject: [PATCH] ext4: fix false negatives *and* false positives in ext4_check_descriptors() commit 44de022c4382541cebdd6de4465d1f4f465ff1dd upstream Ext4_check_descriptors() was getting called before s_gdb_count was initialized. So for file systems w/o the meta_bg feature, allocation bitmaps could overlap the block group descriptors and ext4 wouldn't notice. For file systems with the meta_bg feature enabled, there was a fencepost error which would cause the ext4_check_descriptors() to incorrectly believe that the block allocation bitmap overlaps with the block group descriptor blocks, and it would reject the mount. Fix both of these problems. Signed-off-by: Theodore Ts'o <tytso@mit.edu> Cc: stable@vger.kernel.org Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com> --- fs/ext4/super.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/ext4/super.c b/fs/ext4/super.c index 6b0c1ea95196..f30d2bf40471 100644 --- a/fs/ext4/super.c +++ b/fs/ext4/super.c @@ -2301,7 +2301,7 @@ static int ext4_check_descriptors(struct super_block *sb, struct ext4_sb_info *sbi = EXT4_SB(sb); ext4_fsblk_t first_block = le32_to_cpu(sbi->s_es->s_first_data_block); ext4_fsblk_t last_block; - ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0) + 1; + ext4_fsblk_t last_bg_block = sb_block + ext4_bg_num_gdb(sb, 0); ext4_fsblk_t block_bitmap; ext4_fsblk_t inode_bitmap; ext4_fsblk_t inode_table; @@ -4038,13 +4038,13 @@ static int ext4_fill_super(struct super_block *sb, void *data, int silent) goto failed_mount2; } } + sbi->s_gdb_count = db_count; if (!ext4_check_descriptors(sb, logical_sb_block, &first_not_zeroed)) { ext4_msg(sb, KERN_ERR, "group descriptors corrupted!"); ret = -EFSCORRUPTED; goto failed_mount2; } - sbi->s_gdb_count = db_count; get_random_bytes(&sbi->s_next_generation, sizeof(u32)); spin_lock_init(&sbi->s_next_gen_lock); -- 2.11.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree 2018-08-05 21:25 ` Sudip Mukherjee 2018-08-06 13:40 ` Theodore Y. Ts'o @ 2018-08-07 13:15 ` Greg KH 1 sibling, 0 replies; 5+ messages in thread From: Greg KH @ 2018-08-07 13:15 UTC (permalink / raw) To: Sudip Mukherjee; +Cc: tytso, stable On Sun, Aug 05, 2018 at 10:25:22PM +0100, Sudip Mukherjee wrote: > Hi Greg, > > On Mon, Jul 30, 2018 at 09:58:27AM +0200, gregkh@linuxfoundation.org wrote: > > > > The patch below does not apply to the 4.14-stable tree. > > If someone wants it applied there, or to any other stable or longterm > > tree, then please email the backport, including the original git commit > > id to <stable@vger.kernel.org>. > > The attached backported patch should apply to 4.14-stable tree. Someone else sent this right before you did, thanks. It also was relevant for 4.9 and 4.4 :) greg k-h ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-08-07 15:29 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2018-07-30 7:58 FAILED: patch "[PATCH] ext4: fix false negatives *and* false positives in" failed to apply to 4.14-stable tree gregkh 2018-08-05 21:25 ` Sudip Mukherjee 2018-08-06 13:40 ` Theodore Y. Ts'o 2018-08-07 2:30 ` Theodore Y. Ts'o 2018-08-07 13:15 ` Greg KH
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox