Commit 6756325a authored by Dan Carpenter's avatar Dan Carpenter Committed by David S. Miller

ptp: oops in ptp_ioctl()

If we pass ERR_PTR(-EFAULT) to kfree() then it's going to oops.

Fixes: 2ece068e ('ptp: use memdup_user().')
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent fabb13db
...@@ -211,6 +211,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) ...@@ -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)); sysoff = memdup_user((void __user *)arg, sizeof(*sysoff));
if (IS_ERR(sysoff)) { if (IS_ERR(sysoff)) {
err = PTR_ERR(sysoff); err = PTR_ERR(sysoff);
sysoff = NULL;
break; break;
} }
if (sysoff->n_samples > PTP_MAX_SAMPLES) { if (sysoff->n_samples > PTP_MAX_SAMPLES) {
......
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