summaryrefslogtreecommitdiff
path: root/drivers/ptp/ptp_chardev.c
diff options
context:
space:
mode:
authorMiroslav Lichvar <mlichvar@redhat.com>2018-11-09 11:14:43 +0100
committerDavid S. Miller <davem@davemloft.net>2018-11-09 19:43:50 -0800
commit83d0bdc7390b890905634186baaa294475cd6a06 (patch)
treee23b2f510dd3c51e39efc06c3e74fd43da9b9f17 /drivers/ptp/ptp_chardev.c
parentfbb960ac26172215b8dc6635eac13c3a0739d6ed (diff)
downloadlwn-83d0bdc7390b890905634186baaa294475cd6a06.tar.gz
lwn-83d0bdc7390b890905634186baaa294475cd6a06.zip
ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
If a gettime64 call fails, return the error and avoid copying data back to user. Cc: Richard Cochran <richardcochran@gmail.com> Cc: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/ptp/ptp_chardev.c')
-rw-r--r--drivers/ptp/ptp_chardev.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index b54b8158ff8a..3c681bed5703 100644
--- a/drivers/ptp/ptp_chardev.c
+++ b/drivers/ptp/ptp_chardev.c
@@ -228,7 +228,9 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
- ptp->info->gettime64(ptp->info, &ts);
+ err = ptp->info->gettime64(ptp->info, &ts);
+ if (err)
+ goto out;
pct->sec = ts.tv_sec;
pct->nsec = ts.tv_nsec;
pct++;
@@ -281,6 +283,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg)
break;
}
+out:
kfree(sysoff);
return err;
}