瀏覽代碼

btrfs: handle allocation error in update_dev_stat_item

Reviewed-by: Liu Bo <bo.li.liu@oracle.com>
Signed-off-by: David Sterba <dsterba@suse.com>
David Sterba 8 年之前
父節點
當前提交
fa2529923d
共有 1 個文件被更改,包括 2 次插入1 次删除
  1. 2 1
      fs/btrfs/volumes.c

+ 2 - 1
fs/btrfs/volumes.c

@@ -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,