aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2017-08-23 00:30:52 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2017-08-23 00:30:52 -0400
commit98b9f8a4549909c6ba2117dfc09404989e6d8710 (patch)
tree7316de9ca9b37a5bbfe02b512ce4df9430285f9e
parenteec3b80fb1ccc6320e0dae85c0dfb2666bc898e1 (diff)
parent32aaf194201e98db4235b7b71ac62a22e2ac355f (diff)
Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4
Pull ext4 fixes from Ted Ts'o: "Fix a clang build regression and an potential xattr corruption bug" * tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4: ext4: add missing xattr hash update ext4: fix clang build regression
-rw-r--r--fs/ext4/mballoc.c7
-rw-r--r--fs/ext4/xattr.c6
2 files changed, 9 insertions, 4 deletions
diff --git a/fs/ext4/mballoc.c b/fs/ext4/mballoc.c
index 5a1052627a81..701085620cd8 100644
--- a/fs/ext4/mballoc.c
+++ b/fs/ext4/mballoc.c
@@ -2300,7 +2300,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
2300 EXT4_MAX_BLOCK_LOG_SIZE); 2300 EXT4_MAX_BLOCK_LOG_SIZE);
2301 struct sg { 2301 struct sg {
2302 struct ext4_group_info info; 2302 struct ext4_group_info info;
2303 ext4_grpblk_t counters[blocksize_bits + 2]; 2303 ext4_grpblk_t counters[EXT4_MAX_BLOCK_LOG_SIZE + 2];
2304 } sg; 2304 } sg;
2305 2305
2306 group--; 2306 group--;
@@ -2309,6 +2309,9 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
2309 " 2^0 2^1 2^2 2^3 2^4 2^5 2^6 " 2309 " 2^0 2^1 2^2 2^3 2^4 2^5 2^6 "
2310 " 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]\n"); 2310 " 2^7 2^8 2^9 2^10 2^11 2^12 2^13 ]\n");
2311 2311
2312 i = (blocksize_bits + 2) * sizeof(sg.info.bb_counters[0]) +
2313 sizeof(struct ext4_group_info);
2314
2312 grinfo = ext4_get_group_info(sb, group); 2315 grinfo = ext4_get_group_info(sb, group);
2313 /* Load the group info in memory only if not already loaded. */ 2316 /* Load the group info in memory only if not already loaded. */
2314 if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) { 2317 if (unlikely(EXT4_MB_GRP_NEED_INIT(grinfo))) {
@@ -2320,7 +2323,7 @@ static int ext4_mb_seq_groups_show(struct seq_file *seq, void *v)
2320 buddy_loaded = 1; 2323 buddy_loaded = 1;
2321 } 2324 }
2322 2325
2323 memcpy(&sg, ext4_get_group_info(sb, group), sizeof(sg)); 2326 memcpy(&sg, ext4_get_group_info(sb, group), i);
2324 2327
2325 if (buddy_loaded) 2328 if (buddy_loaded)
2326 ext4_mb_unload_buddy(&e4b); 2329 ext4_mb_unload_buddy(&e4b);
diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 82a5af9f6668..3dd970168448 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1543,7 +1543,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
1543 /* Clear padding bytes. */ 1543 /* Clear padding bytes. */
1544 memset(val + i->value_len, 0, new_size - i->value_len); 1544 memset(val + i->value_len, 0, new_size - i->value_len);
1545 } 1545 }
1546 return 0; 1546 goto update_hash;
1547 } 1547 }
1548 1548
1549 /* Compute min_offs and last. */ 1549 /* Compute min_offs and last. */
@@ -1707,6 +1707,7 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
1707 here->e_value_size = cpu_to_le32(i->value_len); 1707 here->e_value_size = cpu_to_le32(i->value_len);
1708 } 1708 }
1709 1709
1710update_hash:
1710 if (i->value) { 1711 if (i->value) {
1711 __le32 hash = 0; 1712 __le32 hash = 0;
1712 1713
@@ -1725,7 +1726,8 @@ static int ext4_xattr_set_entry(struct ext4_xattr_info *i,
1725 here->e_name_len, 1726 here->e_name_len,
1726 &crc32c_hash, 1); 1727 &crc32c_hash, 1);
1727 } else if (is_block) { 1728 } else if (is_block) {
1728 __le32 *value = s->base + min_offs - new_size; 1729 __le32 *value = s->base + le16_to_cpu(
1730 here->e_value_offs);
1729 1731
1730 hash = ext4_xattr_hash_entry(here->e_name, 1732 hash = ext4_xattr_hash_entry(here->e_name,
1731 here->e_name_len, value, 1733 here->e_name_len, value,