Skip to content

Commit

Permalink
Btrfs: handle kmalloc() failure in inode lookup ioctl
Browse files Browse the repository at this point in the history
Return -ENOMEM if kmalloc() fails.

Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
  • Loading branch information
Dan Carpenter authored and Chris Mason committed Mar 31, 2010
1 parent 683be16 commit c2b9692
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/btrfs/ioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c2b9692

Please sign in to comment.