anolis-cloud-kernel/drivers/ptp
Thomas Weißschuh 1a12709a29 ptp: Ensure info->enable callback is always set
ANBZ: #19170

commit 391e982bfa upstream.

The ioctl and sysfs handlers unconditionally call the ->enable callback.
Not all drivers implement that callback, leading to NULL dereferences.
Example of affected drivers: ptp_s390.c, ptp_vclock.c and ptp_mock.c.

Instead use a dummy callback if no better was specified by the driver.

Fixes: CVE-2025-21814
Fixes: d94ba80ebb ("ptp: Added a brand new class driver for ptp clocks.")
Cc: stable@vger.kernel.org
Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Reviewed-by: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Link: https://patch.msgid.link/20250123-ptp-enable-v1-1-b015834d3a47@weissschuh.net
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Sigend-off-by: Bitao Hu <yaoma@linux.alibaba.com>
Reviewed-by: Guixin Liu <kanie@linux.alibaba.com>
Link: https://gitee.com/anolis/cloud-kernel/pulls/4918
2025-03-27 05:35:28 +00:00
..
Kconfig ptp: arm/arm64: Enable ptp_kvm for arm/arm64 2022-08-02 16:35:22 +08:00
Makefile ptp: arm/arm64: Enable ptp_kvm for arm/arm64 2022-08-02 16:35:22 +08:00
idt8a340_reg.h
ptp_chardev.c
ptp_clock.c ptp: Ensure info->enable callback is always set 2025-03-27 05:35:28 +00:00
ptp_clockmatrix.c
ptp_clockmatrix.h
ptp_dte.c
ptp_idt82p33.c
ptp_idt82p33.h
ptp_ines.c
ptp_kvm_arm.c ptp: arm/arm64: Enable ptp_kvm for arm/arm64 2022-08-02 16:35:22 +08:00
ptp_kvm_common.c ptp: Don't print an error if ptp_kvm is not supported 2022-08-02 16:35:25 +08:00
ptp_kvm_x86.c ptp: Fix ptp_kvm_getcrosststamp issue for x86 ptp_kvm 2023-10-18 10:25:06 +08:00
ptp_pch.c
ptp_private.h anolis: kabi: Reserve some fields 2023-02-24 07:45:32 +00:00
ptp_qoriq.c
ptp_qoriq_debugfs.c
ptp_sysfs.c ptp: replace snprintf with sysfs_emit 2022-04-13 21:00:55 +02:00
ptp_vmw.c