summaryrefslogtreecommitdiff
path: root/include/linux/cdev.h
diff options
context:
space:
mode:
authorJames Hilliard <james.hilliard1@gmail.com>2026-10-26 12:11:27 -0600
committerJakub Kicinski <kuba@kernel.org>2026-10-30 16:15:57 -0700
commit0e4a135aebc7686286d87e286499ce55e5bd5aad (patch)
tree6c3acb14c24e6302f1ee8bd3e57497fd7aa5f643 /include/linux/cdev.h
parent603a0c40d414ea12509fc45f2b930449a8d4aad2 (diff)
ptp: drain virtual clock sysfs operations before unregistering children
Parent clock removal walks its virtual clocks before removing the n_vclocks sysfs attribute. The mutex taken by ptp_vclock_in_use() is released before that walk, so a concurrent sysfs deletion can pick the same child and unregister and free its ptp_vclock a second time. A reference held by the device iterator does not protect that separately allocated virtual clock. Remove n_vclocks before walking the children. Removing the attribute prevents new stores and drains stores already running, without holding n_vclocks_mux across a callback that needs that mutex. Skip virtual clocks, which do not have this attribute. This race was found by code inspection of virtual-clock registration failure cleanup and parent removal. Fixes: bfcbb76b0f59 ("ptp: unregister virtual clocks when unregistering physical clock.") Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev> Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-1-e705612541f1@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/cdev.h')
0 files changed, 0 insertions, 0 deletions