Commit 3b91270a authored by Linus Torvalds's avatar Linus Torvalds

x86-64: make csum_partial_copy_from_user() error handling consistent

Al Viro pointed out that the x86-64 csum_partial_copy_from_user() is
somewhat confused about what it should do on errors, notably it mostly
clears the uncopied end result buffer, but misses that for the initial
alignment case.

All users should check for errors, so it's dubious whether the clearing
is even necessary, and Al also points out that we should probably clean
up the calling conventions, but regardless of any future changes to this
function, the fact that it is inconsistent is just annoying.

So make the __get_user() failure path use the same error exit as all the
other errors do.
Reported-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Cc: David Miller <davem@davemloft.net>
Cc: Andi Kleen <andi@firstfloor.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 5f01feb8
...@@ -41,9 +41,8 @@ csum_partial_copy_from_user(const void __user *src, void *dst, ...@@ -41,9 +41,8 @@ csum_partial_copy_from_user(const void __user *src, void *dst,
while (((unsigned long)src & 6) && len >= 2) { while (((unsigned long)src & 6) && len >= 2) {
__u16 val16; __u16 val16;
*errp = __get_user(val16, (const __u16 __user *)src); if (__get_user(val16, (const __u16 __user *)src))
if (*errp) goto out_err;
return isum;
*(__u16 *)dst = val16; *(__u16 *)dst = val16;
isum = (__force __wsum)add32_with_carry( isum = (__force __wsum)add32_with_carry(
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment