Skip to contentSkip to conversation

iov_iter: fix the uaccess area in copy_compat_iovec_from_user

PATCH In review Christoph Hellwig 2 participants 2 messages Jan 12, 2021 – Jan 16, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iov_iter: fix the uaccess area in copy_compat_iovec_from_user

sizeof needs to be called on the compat pointer, not the native one.

Fixes 89cd35c58bc2 ("iov_iter: transparently handle compat iovecs in import_iovec")
---
 lib/iov_iter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/iov_iter.c +1 -1
index 1635111c5bd2af..a21e6a5792c5a5 100644
@@ -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++) {
Signature · 1 line
2.29.2
maintainer
#1 lore raw
Quoted 1 line · Christoph Hellwig

sizeof needs to be called on the compat pointer, not the native one.

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