kernel
Revisión | e07fb66a09fe81ef3e0f4cb2dcbff46175618462 (tree) |
---|---|
Tiempo | 2019-09-21 14:14:22 |
Autor | Jann Horn <jannh@goog...> |
Commiter | Greg Kroah-Hartman |
floppy: fix usercopy direction
commit 52f6f9d74f31078964ca1574f7bb612da7877ac8 upstream.
As sparse points out, these two copy_from_user() should actually be
copy_to_user().
Fixes: 229b53c9bf4e ("take floppy compat ioctls to sodding floppy.c")
Cc: stable@vger.kernel.org
Acked-by: Alexander Popov <alex.popov@linux.com>
Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>
Signed-off-by: Jann Horn <jannh@google.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
@@ -3784,7 +3784,7 @@ static int compat_getdrvprm(int drive, | ||
3784 | 3784 | v.native_format = UDP->native_format; |
3785 | 3785 | mutex_unlock(&floppy_mutex); |
3786 | 3786 | |
3787 | - if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_params))) | |
3787 | + if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_params))) | |
3788 | 3788 | return -EFAULT; |
3789 | 3789 | return 0; |
3790 | 3790 | } |
@@ -3820,7 +3820,7 @@ static int compat_getdrvstat(int drive, bool poll, | ||
3820 | 3820 | v.bufblocks = UDRS->bufblocks; |
3821 | 3821 | mutex_unlock(&floppy_mutex); |
3822 | 3822 | |
3823 | - if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_struct))) | |
3823 | + if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_struct))) | |
3824 | 3824 | return -EFAULT; |
3825 | 3825 | return 0; |
3826 | 3826 | Eintr: |