Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 02a9079c authored by Vlad Tsyrklevich's avatar Vlad Tsyrklevich Committed by David S. Miller
Browse files

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: default avatarVlad Tsyrklevich <vlad@tsyrklevich.net>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent b8a4ddb2
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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;