提交 adfa97cb 编写于 作者: I Ilya Dryomov 提交者: Chris Mason

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: NIlya Dryomov <idryomov@gmail.com>
Signed-off-by: NJosef Bacik <jbacik@fusionio.com>
Signed-off-by: NChris Mason <chris.mason@fusionio.com>
上级 f747cab7
...@@ -3667,9 +3667,10 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg) ...@@ -3667,9 +3667,10 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
switch (p->cmd) { switch (p->cmd) {
case BTRFS_IOCTL_DEV_REPLACE_CMD_START: case BTRFS_IOCTL_DEV_REPLACE_CMD_START:
if (root->fs_info->sb->s_flags & MS_RDONLY) if (root->fs_info->sb->s_flags & MS_RDONLY) {
return -EROFS; ret = -EROFS;
goto out;
}
if (atomic_xchg( if (atomic_xchg(
&root->fs_info->mutually_exclusive_operation_running, &root->fs_info->mutually_exclusive_operation_running,
1)) { 1)) {
...@@ -3695,7 +3696,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg) ...@@ -3695,7 +3696,7 @@ static long btrfs_ioctl_dev_replace(struct btrfs_root *root, void __user *arg)
if (copy_to_user(arg, p, sizeof(*p))) if (copy_to_user(arg, p, sizeof(*p)))
ret = -EFAULT; ret = -EFAULT;
out:
kfree(p); kfree(p);
return ret; return ret;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册