aboutsummaryrefslogtreecommitdiffstats
path: root/fs/btrfs
diff options
context:
space:
mode:
authorIlya Dryomov <idryomov@gmail.com>2013-10-10 13:39:28 -0400
committerChris Mason <chris.mason@fusionio.com>2013-11-11 22:00:37 -0500
commitadfa97cbdfe376b02bb3e1ea3166958fec35ca6f (patch)
tree4f22a72f87288cbd0299ea0da0b51b5f796cb666 /fs/btrfs
parentf747cab7b75ba298df3ac234de9f1655957786cc (diff)
Btrfs: don't leak ioctl args in btrfs_ioctl_dev_replace
struct btrfs_ioctl_dev_replace_args memory is leaked if replace is requested on a read-only filesystem. Fix it. Signed-off-by: Ilya Dryomov <idryomov@gmail.com> Signed-off-by: Josef Bacik <jbacik@fusionio.com> Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'fs/btrfs')
-rw-r--r--fs/btrfs/ioctl.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c
index 98d4ffef961e..08ac53c5f78d 100644
--- a/fs/btrfs/ioctl.c
+++ b/fs/btrfs/ioctl.c
@@ -3667,9 +3667,10 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
3667 3667
3668 switch (p->cmd) { 3668 switch (p->cmd) {
3669 case BTRFS_IOCTL_DEV_REPLACE_CMD_START: 3669 case BTRFS_IOCTL_DEV_REPLACE_CMD_START:
3670 if (root->fs_info->sb->s_flags & MS_RDONLY) 3670 if (root->fs_info->sb->s_flags & MS_RDONLY) {
3671 return -EROFS; 3671 ret = -EROFS;
3672 3672 goto out;
3673 }
3673 if (atomic_xchg( 3674 if (atomic_xchg(
3674 &root->fs_info->mutually_exclusive_operation_running, 3675 &root->fs_info->mutually_exclusive_operation_running,
3675 1)) { 3676 1)) {
@@ -3695,7 +3696,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
3695 3696
3696 if (copy_to_user(arg, p, sizeof(*p))) 3697 if (copy_to_user(arg, p, sizeof(*p)))
3697 ret = -EFAULT; 3698 ret = -EFAULT;
3698 3699out:
3699 kfree(p); 3700 kfree(p);
3700 return ret; 3701 return ret;
3701} 3702}