linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] floppy: fix usercopy direction
@ 2019-03-26 22:03 Jann Horn
  2019-03-27 12:02 ` Mukesh Ojha
  2019-08-09 13:36 ` Alexander Popov
  0 siblings, 2 replies; 10+ messages in thread
From: Jann Horn @ 2019-03-26 22:03 UTC (permalink / raw)
  To: Jiri Kosina, Jens Axboe, jannh; +Cc: linux-block, linux-kernel, Al Viro

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
Signed-off-by: Jann Horn <jannh@google.com>
---
compile-tested only

 drivers/block/floppy.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c
index 95f608d1a098..8c641245ff12 100644
--- a/drivers/block/floppy.c
+++ b/drivers/block/floppy.c
@@ -3749,7 +3749,7 @@ static int compat_getdrvprm(int drive,
 	v.native_format = UDP->native_format;
 	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 0;
 }
@@ -3785,7 +3785,7 @@ static int compat_getdrvstat(int drive, bool poll,
 	v.bufblocks = UDRS->bufblocks;
 	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 0;
 Eintr:
-- 
2.21.0.392.gf8f6787159e-goog


^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2019-08-13  7:51 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-26 22:03 [PATCH] floppy: fix usercopy direction Jann Horn
2019-03-27 12:02 ` Mukesh Ojha
2019-08-09 13:36 ` Alexander Popov
2019-08-09 13:41   ` Jens Axboe
2019-08-09 13:43     ` Denis Efremov
2019-08-09 13:56   ` Julia Lawall
2019-08-09 15:05     ` Alexander Popov
2019-08-12 10:00       ` Markus Elfring
2019-08-12 10:25       ` [PATCH] " Julia Lawall
2019-08-13  7:50   ` Markus Elfring

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).