linux_dsm_epyc7002/include
Lukas Hannen d545fd4f97 time: Handle negative seconds correctly in timespec64_to_ns()
commit 39ff83f2f6cc5cc1458dfcea9697f96338210beb upstream.

timespec64_ns() prevents multiplication overflows by comparing the seconds
value of the timespec to KTIME_SEC_MAX. If the value is greater or equal it
returns KTIME_MAX.

But that check casts the signed seconds value to unsigned which makes the
comparision true for all negative values and therefore return wrongly
KTIME_MAX.

Negative second values are perfectly valid and required in some places,
e.g. ptp_clock_adjtime().

Remove the cast and add a check for the negative boundary which is required
to prevent undefined behaviour due to multiplication underflow.

Fixes: cb47755725 ("time: Prevent undefined behaviour in timespec64_to_ns()")'
Signed-off-by: Lukas Hannen <lukas.hannen@opensource.tttech-industrial.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/r/AM6PR01MB541637BD6F336B8FFB72AF80EEC69@AM6PR01MB5416.eurprd01.prod.exchangelabs.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-07-05 19:13:39 +02:00
..
acpi ACPI: fix NULL pointer dereference 2024-07-05 18:07:39 +02:00
asm-generic vmlinux.lds.h: Handle clang's module.{c,d}tor sections 2024-07-05 18:55:16 +02:00
clocksource clocksource/drivers/timer-ti-dm: Save and restore timer TIOCP_CFG 2021-07-14 16:56:12 +02:00
crypto crypto: shash - avoid comparing pointers to exported functions under CFI 2021-07-14 16:55:54 +02:00
drm drm: Return -ENOTTY for non-drm ioctls 2021-07-28 14:35:47 +02:00
dt-bindings init: add dsm gpl source 2024-07-05 18:00:04 +02:00
keys certs: Add EFI_CERT_X509_GUID support for dbx entries 2021-06-30 08:47:30 -04:00
kunit kunit: fix display of failed expectations for strings 2020-11-10 13:45:15 -07:00
kvm ARM: 2020-10-23 11:17:56 -07:00
linux time: Handle negative seconds correctly in timespec64_to_ns() 2024-07-05 19:13:39 +02:00
math-emu
media media: subdev: disallow ioctl for saa6588/davinci 2021-07-19 09:45:02 +02:00
memory
misc
net Revert "flow_offload: action should not be NULL when it is referenced" 2024-07-05 18:55:48 +02:00
pcmcia
ras mm,hwpoison: introduce MF_MSG_UNSPLIT_THP 2020-10-16 11:11:17 -07:00
rdma RDMA: Lift ibdev_to_node from rds to common code 2021-02-26 10:12:59 +01:00
scsi init: add dsm gpl source 2024-07-05 18:00:04 +02:00
soc firmware: raspberrypi: Keep count of all consumers 2024-07-05 19:12:05 +02:00
sound ALSA: hda: intel-nhlt: verify config type 2021-03-09 11:11:14 +01:00
target scsi: target: core: Add cmd length set before cmd complete 2021-03-17 17:06:25 +01:00
trace init: add dsm gpl source 2024-07-05 18:00:04 +02:00
uapi bpf: Fix a typo of reuseport map in bpf.h. 2024-07-05 19:10:44 +02:00
vdso
video gpu: ipu-v3: remove unused functions 2020-10-26 10:42:38 +01:00
xen Xen/gntdev: correct error checking in gntdev_map_grant_pages() 2021-02-23 15:53:24 +01:00