netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vlad Tsyrklevich <vlad@tsyrklevich.net>
To: netdev@vger.kernel.org
Cc: richardcochran@gmail.com, Vlad Tsyrklevich <vlad@tsyrklevich.net>
Subject: [PATCH] drivers/ptp: Fix kernel memory disclosure
Date: Tue, 11 Oct 2016 15:02:47 +0200	[thread overview]
Message-ID: <1476190967-38256-1-git-send-email-vlad@tsyrklevich.net> (raw)

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>

---
 drivers/ptp/ptp_chardev.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/ptp/ptp_chardev.c b/drivers/ptp/ptp_chardev.c
index d637c93..58a97d4 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)
 		if (err)
 			break;
 
+		memset(&precise_offset, 0, sizeof(precise_offset));
 		ts = ktime_to_timespec64(xtstamp.device);
 		precise_offset.device.sec = ts.tv_sec;
 		precise_offset.device.nsec = ts.tv_nsec;
-- 
2.7.0

             reply	other threads:[~2016-10-11 13:03 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-11 13:02 Vlad Tsyrklevich [this message]
2016-10-12  9:06 ` [PATCH] drivers/ptp: Fix kernel memory disclosure Richard Cochran
2016-10-13 14:20 ` David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1476190967-38256-1-git-send-email-vlad@tsyrklevich.net \
    --to=vlad@tsyrklevich.net \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).