From: Greg Kroah-Hartman Date: Fri, 19 Jul 2013 00:04:33 +0000 (-0700) Subject: 3.4-stable patches X-Git-Tag: v3.9.11~7 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8582d72ade86efccfd5de550428c4ceb272204a9;p=thirdparty%2Fkernel%2Fstable-queue.git 3.4-stable patches added patches: ext4-don-t-allow-ext4_free_blocks-to-fail-due-to-enomem.patch ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch --- diff --git a/queue-3.4/ext4-don-t-allow-ext4_free_blocks-to-fail-due-to-enomem.patch b/queue-3.4/ext4-don-t-allow-ext4_free_blocks-to-fail-due-to-enomem.patch new file mode 100644 index 00000000000..373d9407681 --- /dev/null +++ b/queue-3.4/ext4-don-t-allow-ext4_free_blocks-to-fail-due-to-enomem.patch @@ -0,0 +1,45 @@ +From e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1 Mon Sep 17 00:00:00 2001 +From: Theodore Ts'o +Date: Sat, 13 Jul 2013 00:40:35 -0400 +Subject: ext4: don't allow ext4_free_blocks() to fail due to ENOMEM + +From: Theodore Ts'o + +commit e7676a704ee0a1ef71a6b23760b5a8f6896cb1a1 upstream. + +The filesystem should not be marked inconsistent if ext4_free_blocks() +is not able to allocate memory. Unfortunately some callers (most +notably ext4_truncate) don't have a way to reflect an error back up to +the VFS. And even if we did, most userspace applications won't deal +with most system calls returning ENOMEM anyway. + +Reported-by: Nagachandra P +Signed-off-by: "Theodore Ts'o" +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/mballoc.c | 11 ++++++++--- + 1 file changed, 8 insertions(+), 3 deletions(-) + +--- a/fs/ext4/mballoc.c ++++ b/fs/ext4/mballoc.c +@@ -4639,11 +4639,16 @@ do_more: + * blocks being freed are metadata. these blocks shouldn't + * be used until this transaction is committed + */ ++ retry: + new_entry = kmem_cache_alloc(ext4_free_data_cachep, GFP_NOFS); + if (!new_entry) { +- ext4_mb_unload_buddy(&e4b); +- err = -ENOMEM; +- goto error_return; ++ /* ++ * We use a retry loop because ++ * ext4_free_blocks() is not allowed to fail. ++ */ ++ cond_resched(); ++ congestion_wait(BLK_RW_ASYNC, HZ/50); ++ goto retry; + } + new_entry->efd_start_cluster = bit; + new_entry->efd_group = block_group; diff --git a/queue-3.4/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch b/queue-3.4/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch new file mode 100644 index 00000000000..31e5d1494eb --- /dev/null +++ b/queue-3.4/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch @@ -0,0 +1,42 @@ +From a60697f411eb365fb09e639e6f183fe33d1eb796 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Fri, 31 May 2013 19:38:56 -0400 +Subject: ext4: fix data offset overflow in ext4_xattr_fiemap() on 32-bit archs + +From: Jan Kara + +commit a60697f411eb365fb09e639e6f183fe33d1eb796 upstream. + +On 32-bit architectures with 32-bit sector_t computation of data offset +in ext4_xattr_fiemap() can overflow resulting in reporting bogus data +location. Fix the problem by typing block number to proper type before +shifting. + +Signed-off-by: Jan Kara +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/extents.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/ext4/extents.c ++++ b/fs/ext4/extents.c +@@ -4713,7 +4713,7 @@ static int ext4_xattr_fiemap(struct inod + error = ext4_get_inode_loc(inode, &iloc); + if (error) + return error; +- physical = iloc.bh->b_blocknr << blockbits; ++ physical = (__u64)iloc.bh->b_blocknr << blockbits; + offset = EXT4_GOOD_OLD_INODE_SIZE + + EXT4_I(inode)->i_extra_isize; + physical += offset; +@@ -4721,7 +4721,7 @@ static int ext4_xattr_fiemap(struct inod + flags |= FIEMAP_EXTENT_DATA_INLINE; + brelse(iloc.bh); + } else { /* external block */ +- physical = EXT4_I(inode)->i_file_acl << blockbits; ++ physical = (__u64)EXT4_I(inode)->i_file_acl << blockbits; + length = inode->i_sb->s_blocksize; + } + diff --git a/queue-3.4/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch b/queue-3.4/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch new file mode 100644 index 00000000000..708d1696dd1 --- /dev/null +++ b/queue-3.4/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch @@ -0,0 +1,43 @@ +From 8af8eecc1331dbf5e8c662022272cf667e213da5 Mon Sep 17 00:00:00 2001 +From: Jan Kara +Date: Fri, 31 May 2013 19:39:56 -0400 +Subject: ext4: fix overflow when counting used blocks on 32-bit architectures + +From: Jan Kara + +commit 8af8eecc1331dbf5e8c662022272cf667e213da5 upstream. + +The arithmetics adding delalloc blocks to the number of used blocks in +ext4_getattr() can easily overflow on 32-bit archs as we first multiply +number of blocks by blocksize and then divide back by 512. Make the +arithmetics more clever and also use proper type (unsigned long long +instead of unsigned long). + +Signed-off-by: Jan Kara +Signed-off-by: Theodore Ts'o +Signed-off-by: Greg Kroah-Hartman + +--- + fs/ext4/inode.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +--- a/fs/ext4/inode.c ++++ b/fs/ext4/inode.c +@@ -4221,7 +4221,7 @@ int ext4_getattr(struct vfsmount *mnt, s + struct kstat *stat) + { + struct inode *inode; +- unsigned long delalloc_blocks; ++ unsigned long long delalloc_blocks; + + inode = dentry->d_inode; + generic_fillattr(inode, stat); +@@ -4238,7 +4238,7 @@ int ext4_getattr(struct vfsmount *mnt, s + */ + delalloc_blocks = EXT4_I(inode)->i_reserved_data_blocks; + +- stat->blocks += (delalloc_blocks << inode->i_sb->s_blocksize_bits)>>9; ++ stat->blocks += delalloc_blocks << (inode->i_sb->s_blocksize_bits-9); + return 0; + } + diff --git a/queue-3.4/series b/queue-3.4/series index 8919e5af1b1..7ab1fe167fa 100644 --- a/queue-3.4/series +++ b/queue-3.4/series @@ -16,3 +16,6 @@ ocfs2-xattr-fix-inlined-xattr-reflink.patch ahci-add-amd-cz-sata-device-id.patch ahci-remove-pmp-link-online-check-in-fbs-eh.patch timer-fix-jiffies-wrap-behavior-of-round_jiffies_common.patch +ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch +ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch +ext4-don-t-allow-ext4_free_blocks-to-fail-due-to-enomem.patch