linux-stable/drivers/ptp
Jakub Kicinski 9a47949562 ptp: improve max_adj check against unreasonable values
[ Upstream commit 475b92f932 ]

Scaled PPM conversion to PPB may (on 64bit systems) result
in a value larger than s32 can hold (freq/scaled_ppm is a long).
This means the kernel will not correctly reject unreasonably
high ->freq values (e.g. > 4294967295ppb, 281474976645 scaled PPM).

The conversion is equivalent to a division by ~66 (65.536),
so the value of ppb is always smaller than ppm, but not small
enough to assume narrowing the type from long -> s32 is okay.

Note that reasonable user space (e.g. ptp4l) will not use such
high values, anyway, 4289046510ppb ~= 4.3x, so the fix is
somewhat pedantic.

Fixes: d39a743511 ("ptp: validate the requested frequency adjustment.")
Fixes: d94ba80ebb ("ptp: Added a brand new class driver for ptp clocks.")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-06-23 14:42:45 +02:00
..
idt8a340_reg.h ptp: ptp_clockmatrix: update to support 4.8.7 firmware 2020-07-30 16:46:59 -07:00
Kconfig phy: dp83640: select CONFIG_CRC32 2021-01-17 14:17:02 +01:00
Makefile ptp: add VMware virtual PTP clock driver 2020-03-05 17:25:07 -08:00
ptp_chardev.c ptp: only allow phase values lower than 1 period 2020-08-05 12:06:44 -07:00
ptp_clock.c ptp: improve max_adj check against unreasonable values 2021-06-23 14:42:45 +02:00
ptp_clockmatrix.c ptp: clockmatrix: bug fix for idtcm_strverscmp 2020-11-25 17:24:49 -08:00
ptp_clockmatrix.h ptp: ptp_clockmatrix: use i2c_master_send for i2c write 2020-08-19 16:23:22 -07:00
ptp_dte.c ptp: ptp_dte: use devm_platform_ioremap_resource() to simplify code 2019-10-10 16:21:13 -07:00
ptp_idt82p33.c ptp: idt82p33: remove unnecessary comparison 2020-04-24 16:59:21 -07:00
ptp_idt82p33.h ptp: Add a ptp clock driver for IDT 82P33 SMU. 2020-02-24 13:08:46 -08:00
ptp_ines.c ptp: ptp_ines: Remove redundant null check 2020-08-26 07:08:59 -07:00
ptp_kvm.c ptp_kvm: Make kvm_ptp_lock static 2020-04-20 11:02:56 -07:00
ptp_pch.c ptp_pch: use generic power management 2020-06-25 12:35:44 -07:00
ptp_private.h ptp: fix the race between the release of ptp_clock and cdev 2019-12-30 20:19:27 -08:00
ptp_qoriq.c ptp_qoriq: fix overflow in ptp_qoriq_adjfine() u64 calcalation 2021-04-10 13:36:09 +02:00
ptp_qoriq_debugfs.c
ptp_sysfs.c
ptp_vmw.c ptp: add VMware virtual PTP clock driver 2020-03-05 17:25:07 -08:00