diff options
Diffstat (limited to 'fs/btrfs/ioctl.c')
-rw-r--r-- | fs/btrfs/ioctl.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/fs/btrfs/ioctl.c b/fs/btrfs/ioctl.c index f1c9bb4079ed..7cc2e8e075b4 100644 --- a/fs/btrfs/ioctl.c +++ b/fs/btrfs/ioctl.c | |||
@@ -964,6 +964,15 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, | |||
964 | name = async_vol_args->name; | 964 | name = async_vol_args->name; |
965 | fd = async_vol_args->fd; | 965 | fd = async_vol_args->fd; |
966 | async_vol_args->name[BTRFS_SNAPSHOT_NAME_MAX] = '\0'; | 966 | async_vol_args->name[BTRFS_SNAPSHOT_NAME_MAX] = '\0'; |
967 | |||
968 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, | ||
969 | subvol, &transid); | ||
970 | |||
971 | if (ret == 0 && | ||
972 | copy_to_user(arg + | ||
973 | offsetof(struct btrfs_ioctl_async_vol_args, | ||
974 | transid), &transid, sizeof(transid))) | ||
975 | ret = -EFAULT; | ||
967 | } else { | 976 | } else { |
968 | vol_args = memdup_user(arg, sizeof(*vol_args)); | 977 | vol_args = memdup_user(arg, sizeof(*vol_args)); |
969 | if (IS_ERR(vol_args)) | 978 | if (IS_ERR(vol_args)) |
@@ -971,16 +980,9 @@ static noinline int btrfs_ioctl_snap_create(struct file *file, | |||
971 | name = vol_args->name; | 980 | name = vol_args->name; |
972 | fd = vol_args->fd; | 981 | fd = vol_args->fd; |
973 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; | 982 | vol_args->name[BTRFS_PATH_NAME_MAX] = '\0'; |
974 | } | ||
975 | 983 | ||
976 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, | 984 | ret = btrfs_ioctl_snap_create_transid(file, name, fd, |
977 | subvol, &transid); | 985 | subvol, NULL); |
978 | |||
979 | if (!ret && async) { | ||
980 | if (copy_to_user(arg + | ||
981 | offsetof(struct btrfs_ioctl_async_vol_args, | ||
982 | transid), &transid, sizeof(transid))) | ||
983 | return -EFAULT; | ||
984 | } | 986 | } |
985 | 987 | ||
986 | kfree(vol_args); | 988 | kfree(vol_args); |