summaryrefslogtreecommitdiff
path: root/drivers/ptp
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2016-05-26 09:46:22 +0300
committerDavid S. Miller <davem@davemloft.net>2016-05-29 22:32:27 -0700
commit6756325a9a1e2d36b6210f4a42f77501c917ebb9 (patch)
tree6962ce79a5ccb72dfd53d474dba0395026707bfe /drivers/ptp
parentfabb13db448efc23c47851550867fc46519de97e (diff)
downloadlinux-rpi-6756325a9a1e2d36b6210f4a42f77501c917ebb9.tar.gz
linux-rpi-6756325a9a1e2d36b6210f4a42f77501c917ebb9.tar.bz2
linux-rpi-6756325a9a1e2d36b6210f4a42f77501c917ebb9.zip
ptp: oops in ptp_ioctl()
If we pass ERR_PTR(-EFAULT) to kfree() then it's going to oops. Fixes: 2ece068e1b1d ('ptp: use memdup_user().') Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp')
-rw-r--r--drivers/ptp/ptp_chardev.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 0b1ac6be69ce..d637c933c8a9 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -211,6 +211,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
sysoff = memdup_user((void __user *)arg, sizeof(*sysoff));
if (IS_ERR(sysoff)) {
err = PTR_ERR(sysoff);
+ sysoff = NULL;
break;
}
if (sysoff->n_samples > PTP_MAX_SAMPLES) {