2020-07-21 22:02:55

by Max Filippov

[permalink] [raw]
Subject: [PATCH] xtensa: fix access check in csum_and_copy_from_user

Commit d341659f470b ("xtensa: switch to providing
csum_and_copy_from_user()") introduced access check, but incorrectly
tested dst instead of src.
Fix access_ok argument in csum_and_copy_from_user.

Cc: Al Viro <[email protected]>
Fixes: d341659f470b ("xtensa: switch to providing csum_and_copy_from_user()")
Signed-off-by: Max Filippov <[email protected]>
---
arch/xtensa/include/asm/checksum.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/xtensa/include/asm/checksum.h b/arch/xtensa/include/asm/checksum.h
index d8292cc9ebdf..243a5fe79d3c 100644
--- a/arch/xtensa/include/asm/checksum.h
+++ b/arch/xtensa/include/asm/checksum.h
@@ -57,7 +57,7 @@ static inline
__wsum csum_and_copy_from_user(const void __user *src, void *dst,
int len, __wsum sum, int *err_ptr)
{
- if (access_ok(dst, len))
+ if (access_ok(src, len))
return csum_partial_copy_generic((__force const void *)src, dst,
len, sum, err_ptr, NULL);
if (len)
--
2.20.1


2020-07-21 23:05:05

by Al Viro

[permalink] [raw]
Subject: Re: [PATCH] xtensa: fix access check in csum_and_copy_from_user

On Tue, Jul 21, 2020 at 03:00:35PM -0700, Max Filippov wrote:
> Commit d341659f470b ("xtensa: switch to providing
> csum_and_copy_from_user()") introduced access check, but incorrectly
> tested dst instead of src.
> Fix access_ok argument in csum_and_copy_from_user.

Applied, with apologies... Which tree do you want it to go through?
I'm dropping it into vfs.git#fixes, will send to Linus unless you
prefer it to go some other way...

2020-07-22 03:54:45

by Max Filippov

[permalink] [raw]
Subject: Re: [PATCH] xtensa: fix access check in csum_and_copy_from_user

On Tue, Jul 21, 2020 at 4:04 PM Al Viro <[email protected]> wrote:
>
> On Tue, Jul 21, 2020 at 03:00:35PM -0700, Max Filippov wrote:
> > Commit d341659f470b ("xtensa: switch to providing
> > csum_and_copy_from_user()") introduced access check, but incorrectly
> > tested dst instead of src.
> > Fix access_ok argument in csum_and_copy_from_user.
>
> Applied, with apologies... Which tree do you want it to go through?
> I'm dropping it into vfs.git#fixes, will send to Linus unless you
> prefer it to go some other way...

NP. Anything that will go into 5.8 is good.

--
Thanks.
-- Max