linux-stable/drivers/ptp
Miroslav Lichvar b2dea2a696 ptp: unregister virtual clocks when unregistering physical clock.
[ Upstream commit bfcbb76b0f ]

When unregistering a physical clock which has some virtual clocks,
unregister the virtual clocks with it.

This fixes the following oops, which can be triggered by unloading
a driver providing a PTP clock when it has enabled virtual clocks:

BUG: unable to handle page fault for address: ffffffffc04fc4d8
Oops: 0000 [#1] PREEMPT SMP NOPTI
RIP: 0010:ptp_vclock_read+0x31/0xb0
Call Trace:
 timecounter_read+0xf/0x50
 ptp_vclock_refresh+0x2c/0x50
 ? ptp_clock_release+0x40/0x40
 ptp_aux_kworker+0x17/0x30
 kthread_worker_fn+0x9b/0x240
 ? kthread_should_park+0x30/0x30
 kthread+0xe2/0x110
 ? kthread_complete_and_exit+0x20/0x20
 ret_from_fork+0x22/0x30

Fixes: 73f37068d5 ("ptp: support ptp physical/virtual clocks conversion")
Signed-off-by: Miroslav Lichvar <mlichvar@redhat.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
Cc: Yangbo Lu <yangbo.lu@nxp.com>
Cc: Yang Yingliang <yangyingliang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2022-04-08 14:23:28 +02:00
..
idt8a340_reg.h
Kconfig ptp: ocp: add COMMON_CLK dependency 2021-09-20 11:11:54 +01:00
Makefile ptp: add ptp virtual clock driver framework 2021-07-01 13:08:18 -07:00
ptp_chardev.c
ptp_clock.c ptp: unregister virtual clocks when unregistering physical clock. 2022-04-08 14:23:28 +02:00
ptp_clockmatrix.c
ptp_clockmatrix.h
ptp_dte.c
ptp_idt82p33.c
ptp_idt82p33.h
ptp_ines.c
ptp_kvm_arm.c
ptp_kvm_common.c
ptp_kvm_x86.c ptp: fix error print of ptp_kvm on X86_64 platform 2021-10-15 11:19:25 +01:00
ptp_ocp.c ptp: ocp: Fix a couple NULL vs IS_ERR() checks 2021-11-25 09:48:40 +01:00
ptp_pch.c ptp_pch: Load module automatically if ID matches 2021-10-02 16:13:00 +01:00
ptp_private.h ptp: add kernel API ptp_get_vclocks_index() 2021-07-01 13:08:18 -07:00
ptp_qoriq.c
ptp_qoriq_debugfs.c
ptp_sysfs.c ptp: Fix possible memory leak caused by invalid cast 2021-08-08 12:56:41 +01:00
ptp_vclock.c net: fix SOF_TIMESTAMPING_BIND_PHC to work with multiple sockets 2022-01-27 11:03:52 +01:00
ptp_vmw.c