diff options
author | Miroslav Lichvar <mlichvar@redhat.com> | 2018-11-09 11:14:43 +0100 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-12 19:46:59 +0100 |
commit | ab143302b0b243e0d751b468361d08b1abb3a778 (patch) | |
tree | df3c676c2b418d3dd5630ae8ae8326b1f97466fb | |
parent | 49796c356187d888bc9b596c9ad138d9f8d3fa36 (diff) | |
download | linux-stable-ab143302b0b243e0d751b468361d08b1abb3a778.tar.gz linux-stable-ab143302b0b243e0d751b468361d08b1abb3a778.tar.bz2 linux-stable-ab143302b0b243e0d751b468361d08b1abb3a778.zip |
ptp: check gettime64 return code in PTP_SYS_OFFSET ioctl
[ Upstream commit 83d0bdc7390b890905634186baaa294475cd6a06 ]
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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r-- | drivers/ptp/ptp_chardev.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index 2012551d93e0..796eeffdf93b 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; } |