linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Laight <David.Laight@ACULAB.COM>
To: 'Christoph Hellwig' <hch@lst.de>,
	"viro@zeniv.linux.org.uk" <viro@zeniv.linux.org.uk>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-fsdevel@vger.kernel.org" <linux-fsdevel@vger.kernel.org>
Subject: RE: [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
Date: Mon, 11 Jan 2021 20:38:04 +0000	[thread overview]
Message-ID: <051a78cc73484e7db68ee86a359a1ab5@AcuMS.aculab.com> (raw)
In-Reply-To: <20210111171926.1528615-1-hch@lst.de>

From: Christoph Hellwig
> Sent: 11 January 2021 17:19
> 
> sizeof needs to be called on the compat pointer, not the native one.
> 
> Fixes: 89cd35c58bc2 ("iov_iter: transparently handle compat iovecs in import_iovec")
> Reported-by: David Laight <David.Laight@ACULAB.COM>
> Signed-off-by: Christoph Hellwig <hch@lst.de>
> ---
>  lib/iov_iter.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/iov_iter.c b/lib/iov_iter.c
> index 1635111c5bd2af..586215aa0f15ce 100644
> --- a/lib/iov_iter.c
> +++ b/lib/iov_iter.c
> @@ -1658,7 +1658,7 @@ static int copy_compat_iovec_from_user(struct iovec *iov,
>  		(const struct compat_iovec __user *)uvec;
>  	int ret = -EFAULT, i;
> 
> -	if (!user_access_begin(uvec, nr_segs * sizeof(*uvec)))
> +	if (!user_access_begin(uvec, nr_segs * sizeof(*uiov)))

The first 'uvec' probably ought to be changed as well.
Even though both variables have the same value.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)


  parent reply	other threads:[~2021-01-11 20:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-11 17:19 [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user Christoph Hellwig
2021-01-11 17:50 ` Al Viro
2021-01-11 20:38 ` David Laight [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-12  8:19 Christoph Hellwig
2021-01-16  4:11 ` Al Viro

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=051a78cc73484e7db68ee86a359a1ab5@AcuMS.aculab.com \
    --to=david.laight@aculab.com \
    --cc=hch@lst.de \
    --cc=linux-fsdevel@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;
as well as URLs for NNTP newsgroup(s).