public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: Jann Horn <jannh@google.com>, Jiri Kosina <jikos@kernel.org>,
	Jens Axboe <axboe@kernel.dk>
Cc: linux-block@vger.kernel.org, linux-kernel@vger.kernel.org,
	Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] floppy: fix usercopy direction
Date: Wed, 27 Mar 2019 17:32:10 +0530	[thread overview]
Message-ID: <b9b3fd01-7a9d-11df-31f9-96f95263dac5@codeaurora.org> (raw)
In-Reply-To: <20190326220348.61172-1-jannh@google.com>


On 3/27/2019 3:33 AM, Jann Horn wrote:
> 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>


Reviewed-by: Mukesh Ojha <mojha@codeaurora.org>

> ---
> 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:

  reply	other threads:[~2019-03-27 12:02 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-26 22:03 [PATCH] floppy: fix usercopy direction Jann Horn
2019-03-27 12:02 ` Mukesh Ojha [this message]
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

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=b9b3fd01-7a9d-11df-31f9-96f95263dac5@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=axboe@kernel.dk \
    --cc=jannh@google.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox