[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160526064622.GA6776@mwanda>
Date: Thu, 26 May 2016 09:46:22 +0300
From: Dan Carpenter <dan.carpenter@...cle.com>
To: Richard Cochran <richardcochran@...il.com>,
Muhammad Falak R Wani <falakreyaz@...il.com>
Cc: netdev@...r.kernel.org, kernel-janitors@...r.kernel.org
Subject: [patch] 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@...cle.com>
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index 0b1ac6b..d637c93 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) {
Powered by blists - more mailing lists