[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <b9b3fd01-7a9d-11df-31f9-96f95263dac5@codeaurora.org>
Date: Wed, 27 Mar 2019 17:32:10 +0530
From: Mukesh Ojha <mojha@...eaurora.org>
To: Jann Horn <jannh@...gle.com>, Jiri Kosina <jikos@...nel.org>,
Jens Axboe <axboe@...nel.dk>
Cc: linux-block@...r.kernel.org, linux-kernel@...r.kernel.org,
Al Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH] floppy: fix usercopy direction
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@...r.kernel.org
> Signed-off-by: Jann Horn <jannh@...gle.com>
Reviewed-by: Mukesh Ojha <mojha@...eaurora.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:
Powered by blists - more mailing lists