summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/Makefile2
-rw-r--r--fs/btrfs/ctree.c14
2 files changed, 13 insertions, 3 deletions
diff --git a/fs/Makefile b/fs/Makefile
index 10c735ad434..2ed4aeac0e5 100644
--- a/fs/Makefile
+++ b/fs/Makefile
@@ -15,7 +15,7 @@ obj-$(CONFIG_FS_BTRFS) += btrfs/
obj-$(CONFIG_FS_CBFS) += cbfs/
obj-$(CONFIG_CMD_CRAMFS) += cramfs/
obj-$(CONFIG_FS_EXT4) += ext4/
-obj-y += fat/
+obj-$(CONFIG_FS_FAT) += fat/
obj-$(CONFIG_FS_JFFS2) += jffs2/
obj-$(CONFIG_CMD_REISER) += reiserfs/
obj-$(CONFIG_SANDBOX) += sandbox/
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index d248d799327..7fae383f150 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -185,10 +185,20 @@ int btrfs_search_tree(const struct btrfs_root *root, struct btrfs_key *key,
p->slots[lvl] = slot;
p->nodes[lvl] = buf;
- if (lvl)
+ if (lvl) {
logical = buf->node.ptrs[slot].blockptr;
- else
+ } else {
+ /*
+ * The path might be invalid if:
+ * cur leaf max < searched value < next leaf min
+ *
+ * Jump to the next valid element if it exists.
+ */
+ if (slot >= buf->header.nritems)
+ if (btrfs_next_slot(p) < 0)
+ goto err;
break;
+ }
}
return 0;