]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
3.0-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Jul 2013 00:04:21 +0000 (17:04 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 19 Jul 2013 00:04:21 +0000 (17:04 -0700)
added patches:
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

queue-3.0/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch [new file with mode: 0644]
queue-3.0/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch [new file with mode: 0644]
queue-3.0/series

diff --git a/queue-3.0/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch b/queue-3.0/ext4-fix-data-offset-overflow-in-ext4_xattr_fiemap-on-32-bit-archs.patch
new file mode 100644 (file)
index 0000000..f080831
--- /dev/null
@@ -0,0 +1,42 @@
+From a60697f411eb365fb09e639e6f183fe33d1eb796 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+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 <jack@suse.cz>
+
+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 <jack@suse.cz>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/extents.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/ext4/extents.c
++++ b/fs/ext4/extents.c
+@@ -4155,7 +4155,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;
+@@ -4163,7 +4163,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.0/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch b/queue-3.0/ext4-fix-overflow-when-counting-used-blocks-on-32-bit-architectures.patch
new file mode 100644 (file)
index 0000000..3df8320
--- /dev/null
@@ -0,0 +1,43 @@
+From 8af8eecc1331dbf5e8c662022272cf667e213da5 Mon Sep 17 00:00:00 2001
+From: Jan Kara <jack@suse.cz>
+Date: Fri, 31 May 2013 19:39:56 -0400
+Subject: ext4: fix overflow when counting used blocks on 32-bit architectures
+
+From: Jan Kara <jack@suse.cz>
+
+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 <jack@suse.cz>
+Signed-off-by: Theodore Ts'o <tytso@mit.edu>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ fs/ext4/inode.c |    4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+--- a/fs/ext4/inode.c
++++ b/fs/ext4/inode.c
+@@ -5481,7 +5481,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);
+@@ -5498,7 +5498,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;
+ }
index b8a6617c266f88636ae303a0238913d3dd64254a..2e7e9ebacdcebc86306ab67a1e2df5924b98c979 100644 (file)
@@ -12,3 +12,5 @@ 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