All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
@ 2021-01-12  8:19 Christoph Hellwig
  2021-01-16  4:11 ` Al Viro
  0 siblings, 1 reply; 5+ messages in thread
From: Christoph Hellwig @ 2021-01-12  8:19 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, linux-fsdevel, David Laight

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..a21e6a5792c5a5 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(uiov, nr_segs * sizeof(*uiov)))
 		return -EFAULT;
 
 	for (i = 0; i < nr_segs; i++) {
-- 
2.29.2


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

* Re: [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
  2021-01-12  8:19 [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user Christoph Hellwig
@ 2021-01-16  4:11 ` Al Viro
  0 siblings, 0 replies; 5+ messages in thread
From: Al Viro @ 2021-01-16  4:11 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, linux-fsdevel, David Laight

On Tue, Jan 12, 2021 at 09:19:05AM +0100, Christoph Hellwig wrote:
> sizeof needs to be called on the compat pointer, not the native one.

in #fixes and #for-next now...

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

* RE: [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
  2021-01-11 17:19 Christoph Hellwig
  2021-01-11 17:50 ` Al Viro
@ 2021-01-11 20:38 ` David Laight
  1 sibling, 0 replies; 5+ messages in thread
From: David Laight @ 2021-01-11 20:38 UTC (permalink / raw)
  To: 'Christoph Hellwig', viro; +Cc: linux-kernel, linux-fsdevel

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)


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

* Re: [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
  2021-01-11 17:19 Christoph Hellwig
@ 2021-01-11 17:50 ` Al Viro
  2021-01-11 20:38 ` David Laight
  1 sibling, 0 replies; 5+ messages in thread
From: Al Viro @ 2021-01-11 17:50 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: linux-kernel, linux-fsdevel, David Laight

On Mon, Jan 11, 2021 at 06:19:26PM +0100, Christoph Hellwig wrote:
> 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>

Applied.

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

* [PATCH] iov_iter: fix the uaccess area in copy_compat_iovec_from_user
@ 2021-01-11 17:19 Christoph Hellwig
  2021-01-11 17:50 ` Al Viro
  2021-01-11 20:38 ` David Laight
  0 siblings, 2 replies; 5+ messages in thread
From: Christoph Hellwig @ 2021-01-11 17:19 UTC (permalink / raw)
  To: viro; +Cc: linux-kernel, linux-fsdevel, David Laight

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)))
 		return -EFAULT;
 
 	for (i = 0; i < nr_segs; i++) {
-- 
2.29.2


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

end of thread, other threads:[~2021-01-16  4:12 UTC | newest]

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

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.