All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jann Horn <jannh@google.com>
To: Jiri Kosina <jikos@kernel.org>, Jens Axboe <axboe@kernel.dk>,
	jannh@google.com
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: [PATCH] floppy: fix usercopy direction
Date: Tue, 26 Mar 2019 23:03:48 +0100	[thread overview]
Message-ID: <20190326220348.61172-1-jannh@google.com> (raw)

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


             reply	other threads:[~2019-03-26 22:05 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 22:03 Jann Horn [this message]
2019-03-27 12:02 ` [PATCH] floppy: fix usercopy direction Mukesh Ojha
2019-08-09 13:36 ` Alexander Popov
2019-08-09 13:36   ` Alexander Popov
2019-08-09 13:36   ` [Cocci] " Alexander Popov
2019-08-09 13:41   ` Jens Axboe
2019-08-09 13:41     ` Jens Axboe
2019-08-09 13:41     ` [Cocci] " Jens Axboe
2019-08-09 13:43     ` Denis Efremov
2019-08-09 13:43       ` Denis Efremov
2019-08-09 13:43       ` [Cocci] " Denis Efremov
2019-08-09 13:56   ` Julia Lawall
2019-08-09 13:56     ` Julia Lawall
2019-08-09 13:56     ` [Cocci] " Julia Lawall
2019-08-09 15:05     ` Alexander Popov
2019-08-09 15:05       ` Alexander Popov
2019-08-09 15:05       ` [Cocci] " Alexander Popov
2019-08-12 10:00       ` Markus Elfring
2019-08-12 10:00         ` [Cocci] " Markus Elfring
2019-08-12 10:00         ` Markus Elfring
2019-08-12 10:25       ` [PATCH] " Julia Lawall
2019-08-12 10:25         ` Julia Lawall
2019-08-12 10:25         ` [Cocci] " Julia Lawall
2019-08-13  7:50   ` Markus Elfring
2019-08-13  7:50     ` [Cocci] " Markus Elfring

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190326220348.61172-1-jannh@google.com \
    --to=jannh@google.com \
    --cc=axboe@kernel.dk \
    --cc=jikos@kernel.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.