[alpha] Prevent a NULL ptr dereference in csum_partial_copy

svn path=/dists/sid/linux/; revision=20895
This commit is contained in:
Ben Hutchings 2013-12-19 11:20:26 +00:00
parent ffc25b2105
commit 42522bf0da
3 changed files with 68 additions and 0 deletions

1
debian/changelog vendored
View File

@ -52,6 +52,7 @@ linux (3.12.5-1) UNRELEASED; urgency=medium
* media: az6007: support Technisat Cablestar Combo HDCI (minus remote)
(Closes: #732106)
* linux-source: Compress with gzip -1 (Closes: #725492)
* [alpha] Prevent a NULL ptr dereference in csum_partial_copy
[ Ian Campbell ]
* [armel/kirkwood+orion] Reenable MARVELL_PHY (Closes: #723177)

View File

@ -0,0 +1,66 @@
From: Jay Estabrook <jay.estabrook@gmail.com>
Date: Sat, 16 Nov 2013 16:45:31 -0800
Subject: alpha: Prevent a NULL ptr dereference in csum_partial_copy.
Origin: https://git.kernel.org/linus/5cfe8f1ba5eebe6f4b6e5858cdb1a5be4f3272a6
Introduced by 3ddc5b46a8e90f3c92 ("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 <mcree@orcon.net.nz>
Signed-off-by: Matt Turner <mattst88@gmail.com>
---
arch/alpha/lib/csum_partial_copy.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/arch/alpha/lib/csum_partial_copy.c b/arch/alpha/lib/csum_partial_copy.c
index ffb19b7..ff3c1072 100644
--- a/arch/alpha/lib/csum_partial_copy.c
+++ b/arch/alpha/lib/csum_partial_copy.c
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}
@@ -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;
}

View File

@ -81,3 +81,4 @@ bugfix/all/xfs-underflow-bug-in-xfs_attrlist_by_handle.patch
bugfix/arm/ahci-imx-Explicitly-clear-IMX6Q_GPR13_SATA_MPLL_CLK_.patch
bugfix/all/disable-some-marvell-phys.patch
features/all/media-az6007-support-Technisat-Cablestar-Combo-HDCI-.patch
bugfix/all/alpha-Prevent-a-NULL-ptr-dereference-in-csum_partial.patch