Commit 52f6f9d7 authored by Jann Horn's avatar Jann Horn Committed by Jens Axboe

floppy: fix usercopy direction

As sparse points out, these two copy_from_user() should actually be
copy_to_user().

Fixes: 229b53c9 ("take floppy compat ioctls to sodding floppy.c")
Cc: stable@vger.kernel.org
Acked-by: default avatarAlexander Popov <alex.popov@linux.com>
Reviewed-by: default avatarMukesh Ojha <mojha@codeaurora.org>
Signed-off-by: default avatarJann Horn <jannh@google.com>
Signed-off-by: default avatarJens Axboe <axboe@kernel.dk>
parent f0e6f416
...@@ -3780,7 +3780,7 @@ static int compat_getdrvprm(int drive, ...@@ -3780,7 +3780,7 @@ static int compat_getdrvprm(int drive,
v.native_format = UDP->native_format; v.native_format = UDP->native_format;
mutex_unlock(&floppy_mutex); mutex_unlock(&floppy_mutex);
if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_params))) if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_params)))
return -EFAULT; return -EFAULT;
return 0; return 0;
} }
...@@ -3816,7 +3816,7 @@ static int compat_getdrvstat(int drive, bool poll, ...@@ -3816,7 +3816,7 @@ static int compat_getdrvstat(int drive, bool poll,
v.bufblocks = UDRS->bufblocks; v.bufblocks = UDRS->bufblocks;
mutex_unlock(&floppy_mutex); mutex_unlock(&floppy_mutex);
if (copy_from_user(arg, &v, sizeof(struct compat_floppy_drive_struct))) if (copy_to_user(arg, &v, sizeof(struct compat_floppy_drive_struct)))
return -EFAULT; return -EFAULT;
return 0; return 0;
Eintr: Eintr:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment