Skip to contentSkip to conversation

ptp: oops in ptp_ioctl()

PATCH Applied Dan Carpenter 3 participants 3 messages May 26, 2016 – May 30, 2016

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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().')
drivers/ptp/ptp_chardev.c +1 -0
index 0b1ac6b..d637c93 100644
@@ -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) {