This Linux kernel change "drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl" is included in the Linux 4.4.187 release. This change is authored by Miroslav Lichvar <mlichvar [at] redhat.com> on Tue Jul 16 16:30:09 2019 -0700. The commit for this change in Linux stable tree is d65f740 (patch) which is from upstream commit 5515e9a. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream 5515e9a.
drivers/pps/pps.c: clear offset flags in PPS_SETPARAMS ioctl commit 5515e9a6273b8c02034466bcbd717ac9f53dab99 upstream. The PPS assert/clear offset corrections are set by the PPS_SETPARAMS ioctl in the pps_ktime structs, which also contain flags. The flags are not initialized by applications (using the timepps.h header) and they are not used by the kernel for anything except returning them back in the PPS_GETPARAMS ioctl. Set the flags to zero to make it clear they are unused and avoid leaking uninitialized data of the PPS_SETPARAMS caller to other applications that have a read access to the PPS device. Link: http://firstname.lastname@example.org Signed-off-by: Miroslav Lichvar <email@example.com> Reviewed-by: Thomas Gleixner <firstname.lastname@example.org> Acked-by: Rodolfo Giometti <email@example.com> Cc: Greg KH <firstname.lastname@example.org> Cc: Dan Carpenter <email@example.com> Signed-off-by: Andrew Morton <firstname.lastname@example.org> Signed-off-by: Linus Torvalds <email@example.com> Signed-off-by: Greg Kroah-Hartman <firstname.lastname@example.org>
There are 8 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.
drivers/pps/pps.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/pps/pps.c b/drivers/pps/pps.c index 2f07cd6..76ae384 100644 --- a/drivers/pps/pps.c +++ b/drivers/pps/pps.c @@ -129,6 +129,14 @@ static long pps_cdev_ioctl(struct file *file, pps->params.mode |= PPS_CANWAIT; pps->params.api_version = PPS_API_VERS; + /* + * Clear unused fields of pps_kparams to avoid leaking + * uninitialized data of the PPS_SETPARAMS caller via + * PPS_GETPARAMS + */ + pps->params.assert_off_tu.flags = 0; + pps->params.clear_off_tu.flags = 0; + spin_unlock_irq(&pps->lock); break;