summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/file-item.c
diff options
context:
space:
mode:
authorliubo <liubo2009@cn.fujitsu.com>2011-01-26 06:22:08 +0000
committerChris Mason <chris.mason@oracle.com>2011-01-28 16:40:36 -0500
commit2a29edc6b60a5248ccab588e7ba7dad38cef0235 (patch)
tree45a7939e9e061cb2f06b09ae5f48aa79853e1250 /fs/btrfs/file-item.c
parent6b82ce8d824bd46053e46a895876cde39d9026e4 (diff)
downloadlinux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.tar.gz
linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.tar.bz2
linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.zip
btrfs: fix several uncheck memory allocations
To make btrfs more stable, add several missing necessary memory allocation checks, and when no memory, return proper errno. We've checked that some of those -ENOMEM errors will be returned to userspace, and some will be catched by BUG_ON() in the upper callers, and none will be ignored silently. Signed-off-by: Liu Bo <liubo2009@cn.fujitsu.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/file-item.c')
-rw-r--r--fs/btrfs/file-item.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/file-item.c b/fs/btrfs/file-item.c
index a562a250ae77..d0bc72657cd7 100644
--- a/fs/btrfs/file-item.c
+++ b/fs/btrfs/file-item.c
@@ -536,6 +536,8 @@ int btrfs_del_csums(struct btrfs_trans_handle *trans,
root = root->fs_info->csum_root;
path = btrfs_alloc_path();
+ if (!path)
+ return -ENOMEM;
while (1) {
key.objectid = BTRFS_EXTENT_CSUM_OBJECTID;