aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDmitry Monakhov2013-04-09 22:56:48 -0500
committerGreg Kroah-Hartman2013-05-07 22:08:24 -0500
commit2ed87d87342a7de090409bf02b2a86ac32191d4f (patch)
tree510fca1e140b09ba451598c818234dfd51693aa9 /fs
parent5c5c79d431221917eef944c4c026b3044a5acc2a (diff)
downloadkernel-omap-2ed87d87342a7de090409bf02b2a86ac32191d4f.tar.gz
kernel-omap-2ed87d87342a7de090409bf02b2a86ac32191d4f.tar.xz
kernel-omap-2ed87d87342a7de090409bf02b2a86ac32191d4f.zip
ext4: fix big-endian bug in metadata checksum calculations
commit 171a7f21a76a0958c225b97c00a97a10390d40ee upstream. Signed-off-by: Dmitry Monakhov <dmonakhov@openvz.org> Signed-off-by: "Theodore Ts'o" <tytso@mit.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/ext4/inode.c8
-rw-r--r--fs/ext4/mmp.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/fs/ext4/inode.c b/fs/ext4/inode.c
index 0dbc84a13385..c0fbd963ca4c 100644
--- a/fs/ext4/inode.c
+++ b/fs/ext4/inode.c
@@ -55,21 +55,21 @@ static __u32 ext4_inode_csum(struct inode *inode, struct ext4_inode *raw,
55 __u16 csum_hi = 0; 55 __u16 csum_hi = 0;
56 __u32 csum; 56 __u32 csum;
57 57
58 csum_lo = raw->i_checksum_lo; 58 csum_lo = le16_to_cpu(raw->i_checksum_lo);
59 raw->i_checksum_lo = 0; 59 raw->i_checksum_lo = 0;
60 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && 60 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
61 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) { 61 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) {
62 csum_hi = raw->i_checksum_hi; 62 csum_hi = le16_to_cpu(raw->i_checksum_hi);
63 raw->i_checksum_hi = 0; 63 raw->i_checksum_hi = 0;
64 } 64 }
65 65
66 csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)raw, 66 csum = ext4_chksum(sbi, ei->i_csum_seed, (__u8 *)raw,
67 EXT4_INODE_SIZE(inode->i_sb)); 67 EXT4_INODE_SIZE(inode->i_sb));
68 68
69 raw->i_checksum_lo = csum_lo; 69 raw->i_checksum_lo = cpu_to_le16(csum_lo);
70 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE && 70 if (EXT4_INODE_SIZE(inode->i_sb) > EXT4_GOOD_OLD_INODE_SIZE &&
71 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi)) 71 EXT4_FITS_IN_INODE(raw, ei, i_checksum_hi))
72 raw->i_checksum_hi = csum_hi; 72 raw->i_checksum_hi = cpu_to_le16(csum_hi);
73 73
74 return csum; 74 return csum;
75} 75}
diff --git a/fs/ext4/mmp.c b/fs/ext4/mmp.c
index 44734f1ca554..fe201c608a75 100644
--- a/fs/ext4/mmp.c
+++ b/fs/ext4/mmp.c
@@ -7,7 +7,7 @@
7#include "ext4.h" 7#include "ext4.h"
8 8
9/* Checksumming functions */ 9/* Checksumming functions */
10static __u32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp) 10static __le32 ext4_mmp_csum(struct super_block *sb, struct mmp_struct *mmp)
11{ 11{
12 struct ext4_sb_info *sbi = EXT4_SB(sb); 12 struct ext4_sb_info *sbi = EXT4_SB(sb);
13 int offset = offsetof(struct mmp_struct, mmp_checksum); 13 int offset = offsetof(struct mmp_struct, mmp_checksum);