summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/export.c
diff options
context:
space:
mode:
authorliubo2011-01-26 07:22:08 +0100
committerChris Mason2011-01-28 22:40:36 +0100
commit2a29edc6b60a5248ccab588e7ba7dad38cef0235 (patch)
tree45a7939e9e061cb2f06b09ae5f48aa79853e1250 /fs/btrfs/export.c
parentbtrfs: fix uncheck memory allocation in btrfs_submit_compressed_read (diff)
downloadkernel-qcow2-linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.tar.gz
kernel-qcow2-linux-2a29edc6b60a5248ccab588e7ba7dad38cef0235.tar.xz
kernel-qcow2-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/export.c')
-rw-r--r--fs/btrfs/export.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/fs/btrfs/export.c b/fs/btrfs/export.c
index 6f0444473594..3220ad1aafc8 100644
--- a/fs/btrfs/export.c
+++ b/fs/btrfs/export.c
@@ -176,6 +176,8 @@ static struct dentry *btrfs_get_parent(struct dentry *child)
int ret;
path = btrfs_alloc_path();
+ if (!path)
+ return ERR_PTR(-ENOMEM);
if (dir->i_ino == BTRFS_FIRST_FREE_OBJECTID) {
key.objectid = root->root_key.objectid;