Skip to content

Commit

Permalink
Merge branch 'for-linus-4.3' of git://git.kernel.org/pub/scm/linux/ke…
Browse files Browse the repository at this point in the history
…rnel/git/mason/linux-btrfs

Pull btrfs fixes from Chris Mason:
 "I have two more small fixes this week:

  Qu's fix avoids unneeded COW during fallocate, and Christian found a
  memory leak in the error handling of an earlier fix"

* 'for-linus-4.3' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/linux-btrfs:
  btrfs: fix possible leak in btrfs_ioctl_balance()
  btrfs: Avoid truncate tailing page if fallocate range doesn't exceed inode size
  • Loading branch information
torvalds committed Oct 23, 2015
2 parents 0386729 + 0f89abf commit 37902bc
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fs/btrfs/file.c
Expand Up @@ -2584,7 +2584,7 @@ static long btrfs_fallocate(struct file *file, int mode,
alloc_start);
if (ret)
goto out;
} else {
} else if (offset + len > inode->i_size) {
/*
* If we are fallocating from the end of the file onward we
* need to zero out the end of the page if i_size lands in the
Expand Down
5 changes: 4 additions & 1 deletion fs/btrfs/ioctl.c
Expand Up @@ -4641,7 +4641,7 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)

if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) {
ret = -EINVAL;
goto out_bargs;
goto out_bctl;
}

do_balance:
Expand All @@ -4655,12 +4655,15 @@ static long btrfs_ioctl_balance(struct file *file, void __user *arg)
need_unlock = false;

ret = btrfs_balance(bctl, bargs);
bctl = NULL;

if (arg) {
if (copy_to_user(arg, bargs, sizeof(*bargs)))
ret = -EFAULT;
}

out_bctl:
kfree(bctl);
out_bargs:
kfree(bargs);
out_unlock:
Expand Down

0 comments on commit 37902bc

Please sign in to comment.