diff options
author | Vlad Tsyrklevich <vlad@tsyrklevich.net> | 2016-10-11 09:02:47 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-13 10:20:06 -0400 |
commit | 02a9079c66341836c4914c33c06a73245060df2e (patch) | |
tree | 55954839f7713011d9681f7626cfb5471d0a1d15 | |
parent | b8a4ddb2e8f44f872fb93bbda2d541b27079fd2b (diff) |
drivers/ptp: Fix kernel memory disclosure
The reserved field precise_offset->rsv is not cleared before being
copied to user space, leaking kernel stack memory. Clear the struct
before it's copied.
Signed-off-by: Vlad Tsyrklevich <vlad@tsyrklevich.net>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/ptp/ptp_chardev.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c index d637c933c8a9..58a97d420572 100644 --- a/drivers/ptp/ptp_chardev.c +++ b/drivers/ptp/ptp_chardev.c | |||
@@ -193,6 +193,7 @@ long ptp_ioctl(struct posix_clock *pc, unsigned int cmd, unsigned long arg) | |||
193 | if (err) | 193 | if (err) |
194 | break; | 194 | break; |
195 | 195 | ||
196 | memset(&precise_offset, 0, sizeof(precise_offset)); | ||
196 | ts = ktime_to_timespec64(xtstamp.device); | 197 | ts = ktime_to_timespec64(xtstamp.device); |
197 | precise_offset.device.sec = ts.tv_sec; | 198 | precise_offset.device.sec = ts.tv_sec; |
198 | precise_offset.device.nsec = ts.tv_nsec; | 199 | precise_offset.device.nsec = ts.tv_nsec; |