]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
Btrfs: fix verification of dir_item
authorFilipe David Borba Manana <fdmanana@gmail.com>
Mon, 28 Oct 2013 16:28:30 +0000 (16:28 +0000)
committerChris Mason <chris.mason@fusionio.com>
Tue, 12 Nov 2013 03:10:36 +0000 (22:10 -0500)
We were ignoring the name component of the dir_item. Both the
name and data must fit within BTRFS_MAX_XATTR_SIZE(root).

Signed-off-by: Filipe David Borba Manana <fdmanana@gmail.com>
Signed-off-by: Josef Bacik <jbacik@fusionio.com>
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
fs/btrfs/dir-item.c

index 1c529db1697f33a01d7c999311fb240fc472c9e8..c031ea3fd70f70d64452a3529d3ef99c830a57bf 100644 (file)
@@ -474,8 +474,10 @@ int verify_dir_item(struct btrfs_root *root,
        }
 
        /* BTRFS_MAX_XATTR_SIZE is the same for all dir items */
-       if (btrfs_dir_data_len(leaf, dir_item) > BTRFS_MAX_XATTR_SIZE(root)) {
-               printk(KERN_CRIT "btrfs: invalid dir item data len: %u\n",
+       if ((btrfs_dir_data_len(leaf, dir_item) +
+            btrfs_dir_name_len(leaf, dir_item)) > BTRFS_MAX_XATTR_SIZE(root)) {
+               printk(KERN_CRIT "btrfs: invalid dir item name + data len: %u + %u\n",
+                      (unsigned)btrfs_dir_name_len(leaf, dir_item),
                       (unsigned)btrfs_dir_data_len(leaf, dir_item));
                return 1;
        }