Message ID | 20160526064622.GA6776@mwanda |
---|---|
State | Accepted, archived |
Delegated to: | David Miller |
Headers | show |
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 <richardcochran@gmail.com>
From: Dan Carpenter <dan.carpenter@oracle.com> 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 <dan.carpenter@oracle.com> Applied, thanks.
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) {
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@oracle.com>