]> git.baikalelectronics.ru Git - kernel.git/commitdiff
drivers/ptp: Fix kernel memory disclosure
authorVlad Tsyrklevich <vlad@tsyrklevich.net>
Tue, 11 Oct 2016 13:02:47 +0000 (15:02 +0200)
committerDavid S. Miller <davem@davemloft.net>
Thu, 13 Oct 2016 14:20:06 +0000 (10:20 -0400)
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>
drivers/ptp/ptp_chardev.c

index d637c933c8a90655ffe152101dda2b9c71fd3836..58a97d4205723fff7e25f454480169b6f658b0a4 100644 (file)
@@ -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;