Răsfoiți Sursa

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 ani în urmă
părinte
comite
fa2529923d
1 a modificat fișierele cu 2 adăugiri și 1 ștergeri
  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;
 	key.offset = device->devid;
 
 
 	path = btrfs_alloc_path();
 	path = btrfs_alloc_path();
-	BUG_ON(!path);
+	if (!path)
+		return -ENOMEM;
 	ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
 	ret = btrfs_search_slot(trans, dev_root, &key, path, -1, 1);
 	if (ret < 0) {
 	if (ret < 0) {
 		btrfs_warn_in_rcu(fs_info,
 		btrfs_warn_in_rcu(fs_info,