ptp: Ensure info->enable callback is always set
ANBZ: #19170 commit391e982bfa
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
This commit is contained in:
parent
3a8b856423
commit
1a12709a29
|
@ -186,6 +186,11 @@ static void ptp_clock_release(struct device *dev)
|
|||
kfree(ptp);
|
||||
}
|
||||
|
||||
static int ptp_enable(struct ptp_clock_info *ptp, struct ptp_clock_request *request, int on)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
||||
static void ptp_aux_kworker(struct kthread_work *work)
|
||||
{
|
||||
struct ptp_clock *ptp = container_of(work, struct ptp_clock,
|
||||
|
@ -193,6 +198,9 @@ static void ptp_aux_kworker(struct kthread_work *work)
|
|||
struct ptp_clock_info *info = ptp->info;
|
||||
long delay;
|
||||
|
||||
if (!ptp->info->enable)
|
||||
ptp->info->enable = ptp_enable;
|
||||
|
||||
delay = info->do_aux_work(info);
|
||||
|
||||
if (delay >= 0)
|
||||
|
|
Loading…
Reference in New Issue