]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commit
ptp: unregister virtual clocks when unregistering physical clock.
authorMiroslav Lichvar <mlichvar@redhat.com>
Wed, 2 Feb 2022 09:33:55 +0000 (10:33 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Fri, 20 May 2022 12:38:47 +0000 (14:38 +0200)
commit0db819c99fbeb2f18fe1215e54c8f2f133234d47
tree2c708d410b0d66b546fb0eb2104177f9a42a2422
parent8f10346d0a50cf594a2685def853cd05b40b3019
ptp: unregister virtual clocks when unregistering physical clock.

BugLink: https://bugs.launchpad.net/bugs/1969110
[ Upstream commit bfcbb76b0f595ea9ede9f7a218086fef85242f10 ]

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: 73f37068d540 ("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>
(cherry picked from commit b2dea2a696d09163da4cd33cb598ce1f73e86597)
Signed-off-by: Paolo Pisati <paolo.pisati@canonical.com>
drivers/ptp/ptp_clock.c