]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ptp: Ensure info->enable callback is always set
authorThomas Weißschuh <linux@weissschuh.net>
Thu, 23 Jan 2025 07:22:40 +0000 (08:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:33 +0000 (12:50 +0100)
commit1334c64a5d1de6666e0c9f984db6745083df1eb4
tree783e19d5bcc8fa0bce6d3ed04f7c880e43299015
parent0eda6b12a108c839fbff5b23345a0954b7e0b972
ptp: Ensure info->enable callback is always set

commit fd53aa40e65f518453115b6f56183b0c201db26b 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: d94ba80ebbea ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/ptp/ptp_clock.c