Skip to content

Commit

Permalink
alpha: Prevent a NULL ptr dereference in csum_partial_copy.
Browse files Browse the repository at this point in the history
Introduced by 3ddc5b4 ("kernel-wide: fix missing validations
on __get/__put/__copy_to/__copy_from_user()").

Also fix some other places which could be problematic in a similar way,
although they hadn't been proved so, as far as I can tell.

Cc: Michael Cree <[email protected]>
Signed-off-by: Matt Turner <[email protected]>
  • Loading branch information
Jay Estabrook authored and mattst88 committed Nov 17, 2013
1 parent 6e22f8f commit 5cfe8f1
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions arch/alpha/lib/csum_partial_copy.c
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ csum_partial_cfu_aligned(const unsigned long __user *src, unsigned long *dst,
*dst = word | tmp;
checksum += carry;
}
if (err) *errp = err;
if (err && errp) *errp = err;
return checksum;
}

Expand Down Expand Up @@ -185,7 +185,7 @@ csum_partial_cfu_dest_aligned(const unsigned long __user *src,
*dst = word | tmp;
checksum += carry;
}
if (err) *errp = err;
if (err && errp) *errp = err;
return checksum;
}

Expand Down Expand Up @@ -242,7 +242,7 @@ csum_partial_cfu_src_aligned(const unsigned long __user *src,
stq_u(partial_dest | second_dest, dst);
out:
checksum += carry;
if (err) *errp = err;
if (err && errp) *errp = err;
return checksum;
}

Expand Down Expand Up @@ -325,7 +325,7 @@ csum_partial_cfu_unaligned(const unsigned long __user * src,
stq_u(partial_dest | word | second_dest, dst);
checksum += carry;
}
if (err) *errp = err;
if (err && errp) *errp = err;
return checksum;
}

Expand All @@ -339,7 +339,7 @@ csum_partial_copy_from_user(const void __user *src, void *dst, int len,

if (len) {
if (!access_ok(VERIFY_READ, src, len)) {
*errp = -EFAULT;
if (errp) *errp = -EFAULT;
memset(dst, 0, len);
return sum;
}
Expand Down

0 comments on commit 5cfe8f1

Please sign in to comment.