From: Dan Carpenter Date: Thu, 26 May 2016 06:46:22 +0000 (+0300) Subject: ptp: oops in ptp_ioctl() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6756325a9a1e2d36b6210f4a42f77501c917ebb9;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Richard Cochran Signed-off-by: David S. Miller --- 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) {