diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 18:17:58 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-10-23 18:17:58 -0400 |
commit | 37902bc190f1396a8c232783b29ddfcaa4026028 (patch) | |
tree | bb13b0d32a6509c935d60af64adc9a86308c0619 | |
parent | 03867292476e6fa7679395838d768dda0a0816c7 (diff) | |
parent | 0f89abf56abbd0e1c6e3cef9813e6d9f05383c1e (diff) |
Merge branch 'for-linus-4.3' of git://git.kernel.org/pub/scm/linux/kernel/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
-rw-r--r-- | fs/btrfs/file.c | 2 | ||||
-rw-r--r-- | fs/btrfs/ioctl.c | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/fs/btrfs/file.c b/fs/btrfs/file.c index b823fac91c92..8c6f247ba81d 100644 --- a/fs/btrfs/file.c +++ b/fs/btrfs/file.c | |||
@@ -2584,7 +2584,7 @@ static long btrfs_fallocate(struct file *file, int mode, | |||
2584 | alloc_start); | 2584 | alloc_start); |
2585 | if (ret) | 2585 | if (ret) |
2586 | goto out; | 2586 | goto out; |
2587 | } else { | 2587 | } else if (offset + len > inode->i_size) { |
2588 | /* | 2588 | /* |
2589 | * If we are fallocating from the end of the file onward we | 2589 | * If we are fallocating from the end of the file onward we |
2590 | * need to zero out the end of the page if i_size lands in the | 2590 | * need to zero out the end of the page if i_size lands in the |
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index 3e3e6130637f..8d20f3b1cab0 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -4641,7 +4641,7 @@ locked: | |||
4641 | 4641 | ||
4642 | if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) { | 4642 | if (bctl->flags & ~(BTRFS_BALANCE_ARGS_MASK | BTRFS_BALANCE_TYPE_MASK)) { |
4643 | ret = -EINVAL; | 4643 | ret = -EINVAL; |
4644 | goto out_bargs; | 4644 | goto out_bctl; |
4645 | } | 4645 | } |
4646 | 4646 | ||
4647 | do_balance: | 4647 | do_balance: |
@@ -4655,12 +4655,15 @@ do_balance: | |||
4655 | need_unlock = false; | 4655 | need_unlock = false; |
4656 | 4656 | ||
4657 | ret = btrfs_balance(bctl, bargs); | 4657 | ret = btrfs_balance(bctl, bargs); |
4658 | bctl = NULL; | ||
4658 | 4659 | ||
4659 | if (arg) { | 4660 | if (arg) { |
4660 | if (copy_to_user(arg, bargs, sizeof(*bargs))) | 4661 | if (copy_to_user(arg, bargs, sizeof(*bargs))) |
4661 | ret = -EFAULT; | 4662 | ret = -EFAULT; |
4662 | } | 4663 | } |
4663 | 4664 | ||
4665 | out_bctl: | ||
4666 | kfree(bctl); | ||
4664 | out_bargs: | 4667 | out_bargs: |
4665 | kfree(bargs); | 4668 | kfree(bargs); |
4666 | out_unlock: | 4669 | out_unlock: |