From: Josef Bacik Date: Tue, 30 Jul 2013 19:44:09 +0000 (-0400) Subject: Btrfs: check to see if we have an inline item properly X-Git-Tag: v3.12-rc1~40^2~85 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=d062d13cf1a100d5632306a28f9a9f54aced1280;p=linux.git Btrfs: check to see if we have an inline item properly If our item isn't big enough to have an actual inline item when we have skinny metadata enabled just return 1 in find_inline_backref so we can move on to the next item. This probably wasn't causing a problem since we check the values of ptr and end properly, but just in case this will keep us from doing extra work. Thanks, Signed-off-by: Josef Bacik Signed-off-by: Chris Mason --- diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c index 5a23d875ab40..8168fb351adb 100644 --- a/fs/btrfs/relocation.c +++ b/fs/btrfs/relocation.c @@ -641,6 +641,11 @@ int find_inline_backref(struct extent_buffer *leaf, int slot, WARN_ON(item_size < sizeof(*ei) + sizeof(*bi)); return 1; } + if (key.type == BTRFS_METADATA_ITEM_KEY && + item_size <= sizeof(*ei)) { + WARN_ON(item_size < sizeof(*ei)); + return 1; + } if (key.type == BTRFS_EXTENT_ITEM_KEY) { bi = (struct btrfs_tree_block_info *)(ei + 1);