Re: [patch] ptp: oops in ptp_ioctl()

2016-05-29 Thread David Miller
From: Dan Carpenter 
Date: Thu, 26 May 2016 09:46:22 +0300

> 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 

Applied, thanks.


Re: [patch] ptp: oops in ptp_ioctl()

2016-05-26 Thread Richard Cochran
On Thu, May 26, 2016 at 09:46:22AM +0300, Dan Carpenter wrote:
> If we pass ERR_PTR(-EFAULT) to kfree() then it's going to oops.

Thanks for catching this.

Acked-by: Richard Cochran 


[patch] ptp: oops in ptp_ioctl()

2016-05-25 Thread Dan Carpenter
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 

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) {