Btrfs: handle kmalloc() failure in inode lookup ioctl
authorDan Carpenter <error27@gmail.com>
Sat, 20 Mar 2010 11:24:15 +0000 (11:24 +0000)
committerChris Mason <chris.mason@oracle.com>
Wed, 31 Mar 2010 01:19:09 +0000 (21:19 -0400)
Return -ENOMEM if kmalloc() fails.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
fs/btrfs/ioctl.c

index 874d36e..74d8913 100644 (file)
@@ -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;