]> git.ipfire.org Git - thirdparty/linux.git/commit
ptp: vclock: Switch from RCU to SRCU
authorKurt Kanzenbach <kurt@linutronix.de>
Fri, 29 May 2026 17:11:47 +0000 (19:11 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 4 Jun 2026 01:58:54 +0000 (18:58 -0700)
commit672bd0519e27c357c43b7f8c0d653fce3817d06e
tree1846fe3f96a8d59ad4a3e32cb8e5abf00458ea96
parentd3915a1f5a4bc0ac911032903c3c6ab8df9fcc7c
ptp: vclock: Switch from RCU to SRCU

The usage of PTP vClocks leads immediately to the following issues with
ptp4l with LOCKDEP and DEBUG_ATOMIC_SLEEP enabled: "BUG: sleeping function
called from invalid context".

ptp_convert_timestamp() acquires a mutex_t within a RCU read section.  This
is illegal, because acquiring a mutex_t can result in voluntary scheduling
request which is not allowed within a RCU read section.

Replace the RCU usage with SRCU where sleeping is allowed.

Reported-by: Florian Zeitz <florian.zeitz@schettke.com>
Closes: https://lore.kernel.org/all/00a8cce8-410e-4038-98af-49be6d93d7bd@schettke.com/
Fixes: 67d93ffc0f3c ("ptp: vclock: use mutex to fix "sleep on atomic" bug")
Signed-off-by: Kurt Kanzenbach <kurt@linutronix.de>
Reviewed-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Link: https://patch.msgid.link/20260529-vclock_rcu-v2-1-02a5531fab92@linutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/ptp/ptp_vclock.c