Merge tag 'ext4_for_linus_stable' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-block.git] / fs / ext4 / xattr.c
index 2a006e4db46718aaccd4a0a2bc8b0097bea30f20..767454d74cd696fbd20c4a0d925b645b893c70a6 100644 (file)
@@ -527,11 +527,12 @@ ext4_xattr_inode_verify_hashes(struct inode *ea_inode,
                 */
                e_hash = ext4_xattr_hash_entry_signed(entry->e_name, entry->e_name_len,
                                                        &tmp_data, 1);
-               if (e_hash == entry->e_hash)
-                       return 0;
-
                /* Still no match - bad */
-               return -EFSCORRUPTED;
+               if (e_hash != entry->e_hash)
+                       return -EFSCORRUPTED;
+
+               /* Let people know about old hash */
+               pr_warn_once("ext4: filesystem with signed xattr name hash");
        }
        return 0;
 }
@@ -3157,7 +3158,7 @@ static __le32 ext4_xattr_hash_entry(char *name, size_t name_len, __le32 *value,
        while (name_len--) {
                hash = (hash << NAME_HASH_SHIFT) ^
                       (hash >> (8*sizeof(hash) - NAME_HASH_SHIFT)) ^
-                      *name++;
+                      (unsigned char)*name++;
        }
        while (value_count--) {
                hash = (hash << VALUE_HASH_SHIFT) ^