diff options
-rw-r--r-- | fs/btrfs/ctree.c | 6 | ||||
-rw-r--r-- | fs/btrfs/disk-io.c | 8 | ||||
-rw-r--r-- | fs/btrfs/extent_io.c | 2 |
3 files changed, 16 insertions, 0 deletions
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c index 99599f1c1554..b5baff0dccfe 100644 --- a/fs/btrfs/ctree.c +++ b/fs/btrfs/ctree.c | |||
@@ -2516,6 +2516,9 @@ static int push_leaf_right(struct btrfs_trans_handle *trans, struct btrfs_root | |||
2516 | btrfs_assert_tree_locked(path->nodes[1]); | 2516 | btrfs_assert_tree_locked(path->nodes[1]); |
2517 | 2517 | ||
2518 | right = read_node_slot(root, upper, slot + 1); | 2518 | right = read_node_slot(root, upper, slot + 1); |
2519 | if (right == NULL) | ||
2520 | return 1; | ||
2521 | |||
2519 | btrfs_tree_lock(right); | 2522 | btrfs_tree_lock(right); |
2520 | btrfs_set_lock_blocking(right); | 2523 | btrfs_set_lock_blocking(right); |
2521 | 2524 | ||
@@ -2766,6 +2769,9 @@ static int push_leaf_left(struct btrfs_trans_handle *trans, struct btrfs_root | |||
2766 | btrfs_assert_tree_locked(path->nodes[1]); | 2769 | btrfs_assert_tree_locked(path->nodes[1]); |
2767 | 2770 | ||
2768 | left = read_node_slot(root, path->nodes[1], slot - 1); | 2771 | left = read_node_slot(root, path->nodes[1], slot - 1); |
2772 | if (left == NULL) | ||
2773 | return 1; | ||
2774 | |||
2769 | btrfs_tree_lock(left); | 2775 | btrfs_tree_lock(left); |
2770 | btrfs_set_lock_blocking(left); | 2776 | btrfs_set_lock_blocking(left); |
2771 | 2777 | ||
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index f9efb68fc2e3..a0c37b2ee9ed 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c | |||
@@ -353,6 +353,10 @@ static int csum_dirty_buffer(struct btrfs_root *root, struct page *page) | |||
353 | WARN_ON(len == 0); | 353 | WARN_ON(len == 0); |
354 | 354 | ||
355 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); | 355 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); |
356 | if (eb == NULL) { | ||
357 | WARN_ON(1); | ||
358 | goto out; | ||
359 | } | ||
356 | ret = btree_read_extent_buffer_pages(root, eb, start + PAGE_CACHE_SIZE, | 360 | ret = btree_read_extent_buffer_pages(root, eb, start + PAGE_CACHE_SIZE, |
357 | btrfs_header_generation(eb)); | 361 | btrfs_header_generation(eb)); |
358 | BUG_ON(ret); | 362 | BUG_ON(ret); |
@@ -427,6 +431,10 @@ static int btree_readpage_end_io_hook(struct page *page, u64 start, u64 end, | |||
427 | WARN_ON(len == 0); | 431 | WARN_ON(len == 0); |
428 | 432 | ||
429 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); | 433 | eb = alloc_extent_buffer(tree, start, len, page, GFP_NOFS); |
434 | if (eb == NULL) { | ||
435 | ret = -EIO; | ||
436 | goto out; | ||
437 | } | ||
430 | 438 | ||
431 | found_start = btrfs_header_bytenr(eb); | 439 | found_start = btrfs_header_bytenr(eb); |
432 | if (found_start != start) { | 440 | if (found_start != start) { |
diff --git a/fs/btrfs/extent_io.c b/fs/btrfs/extent_io.c index f1d198128959..8b8d3d99ae68 100644 --- a/fs/btrfs/extent_io.c +++ b/fs/btrfs/extent_io.c | |||
@@ -3075,6 +3075,8 @@ static struct extent_buffer *__alloc_extent_buffer(struct extent_io_tree *tree, | |||
3075 | #endif | 3075 | #endif |
3076 | 3076 | ||
3077 | eb = kmem_cache_zalloc(extent_buffer_cache, mask); | 3077 | eb = kmem_cache_zalloc(extent_buffer_cache, mask); |
3078 | if (eb == NULL) | ||
3079 | return NULL; | ||
3078 | eb->start = start; | 3080 | eb->start = start; |
3079 | eb->len = len; | 3081 | eb->len = len; |
3080 | spin_lock_init(&eb->lock); | 3082 | spin_lock_init(&eb->lock); |