summaryrefslogtreecommitdiffstats
path: root/fs/btrfs/ioctl.c
diff options
context:
space:
mode:
authorDan Carpenter <error27@gmail.com>2010-03-20 12:24:15 +0100
committerChris Mason <chris.mason@oracle.com>2010-03-31 03:19:09 +0200
commitc2b96929e2ca6914cf4a66cd8fe2a34c4a98277f (patch)
treeacfc0f7c28305f2057e6eed88ffd8b34441ba2e1 /fs/btrfs/ioctl.c
parentBtrfs: dereferencing freed memory (diff)
downloadlinux-c2b96929e2ca6914cf4a66cd8fe2a34c4a98277f.tar.xz
linux-c2b96929e2ca6914cf4a66cd8fe2a34c4a98277f.zip
Btrfs: handle kmalloc() failure in inode lookup ioctl
Return -ENOMEM if kmalloc() fails. Signed-off-by: Dan Carpenter <error27@gmail.com> Signed-off-by: Chris Mason <chris.mason@oracle.com>
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r--fs/btrfs/ioctl.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 874d36e5f167..74d89133f768 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -1211,6 +1211,9 @@ static noinline int btrfs_ioctl_ino_lookup(struct file *file,
return -EPERM;
args = kmalloc(sizeof(*args), GFP_KERNEL);
+ if (!args)
+ return -ENOMEM;
+
if (copy_from_user(args, argp, sizeof(*args))) {
kfree(args);
return -EFAULT;