Skip to content

Commit

Permalink
iov_iter: fix the uaccess area in copy_compat_iovec_from_user
Browse files Browse the repository at this point in the history
sizeof needs to be called on the compat pointer, not the native one.

Fixes: 89cd35c ("iov_iter: transparently handle compat iovecs in import_iovec")
Reported-by: David Laight <[email protected]>
Signed-off-by: Christoph Hellwig <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Christoph Hellwig authored and Al Viro committed Jan 16, 2021
1 parent a0a6df9 commit a959a97
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/iov_iter.c
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down

0 comments on commit a959a97

Please sign in to comment.