diff options
author | Mark Fasheh <mfasheh@suse.com> | 2011-07-13 19:59:59 +0200 |
---|---|---|
committer | Mark Fasheh <mfasheh@suse.com> | 2011-07-25 23:35:15 +0200 |
commit | 38a1a919535742af677303271eb4ff731547b706 (patch) | |
tree | bfefad00f864e8239b94607a3d712200fd825eaa /fs | |
parent | btrfs: Don't BUG_ON alloc_path errors in find_next_chunk (diff) | |
download | linux-38a1a919535742af677303271eb4ff731547b706.tar.xz linux-38a1a919535742af677303271eb4ff731547b706.zip |
btrfs: don't BUG_ON allocation errors in btrfs_drop_snapshot
In addition to properly handling allocation failure from btrfs_alloc_path, I
also fixed up the kzalloc error handling code immediately below it.
Signed-off-by: Mark Fasheh <mfasheh@suse.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/extent-tree.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c index f6af4236e59b..6bce721e7bbc 100644 --- a/fs/btrfs/extent-tree.c +++ b/fs/btrfs/extent-tree.c @@ -6272,10 +6272,14 @@ int btrfs_drop_snapshot(struct btrfs_root *root, int level; path = btrfs_alloc_path(); - BUG_ON(!path); + if (!path) + return -ENOMEM; wc = kzalloc(sizeof(*wc), GFP_NOFS); - BUG_ON(!wc); + if (!wc) { + btrfs_free_path(path); + return -ENOMEM; + } trans = btrfs_start_transaction(tree_root, 0); BUG_ON(IS_ERR(trans)); |