btrfs: handle allocation error in update_dev_stat_item
authorDavid Sterba <dsterba@suse.com>
Wed, 15 Feb 2017 08:35:01 +0000 (09:35 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 28 Feb 2017 13:27:11 +0000 (14:27 +0100)
Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/volumes.c

index b443cc7..7c8c7bb 100644 (file)
@@ -6956,7 +6956,8 @@ static int update_dev_stat_item(struct btrfs_trans_handle *trans,
        key.offset = device->devid;
 
        path = btrfs_alloc_path();
-       BUG_ON(!path);
+       if (!path)
+               return -ENOMEM;
        ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
        if (ret < 0) {
                btrfs_warn_in_rcu(fs_info,