summaryrefslogtreecommitdiff
path: root/include/linux
diff options
context:
space:
mode:
authorJames Hilliard <james.hilliard1@gmail.com>2026-10-26 12:11:30 -0600
committerJakub Kicinski <kuba@kernel.org>2026-10-30 16:15:58 -0700
commitd3fcce5afe3bb62e8f7a2efb29e43da4fe4ae1f3 (patch)
tree39c056788279dca0954d0228ccfecb95bd411995 /include/linux
parentd1bdfdafd663dd00b01d43eb3391f87718f2a09d (diff)
ptp: vclock: serialize extended samples with counter updates
The extended and cross-timestamp callbacks sample the physical clock before taking the virtual clock mutex. A concurrent frequency adjustment can advance the timecounter and change its multiplier in between, so the older sample is converted using a different frequency than the one in effect when it was taken. Take the mutex before sampling and keep it held through the conversion. Retain timecounter_cyc2time() and its existing conversion window. A PHC sample need not advance the counter: for example, e1000e explicitly allows non-monotonic SYSTIM readings. Treating a slightly older sample as a forward delta would instead advance virtual time by nearly a full counter wrap. This race was found by code inspection of the virtual clock sampling paths. Fixes: f0067ebfc42b ("ptp: add gettimex64() to virtual clocks.") Fixes: 21fad63084c2 ("ptp: add getcrosststamp() to virtual clocks.") Signed-off-by: James Hilliard <james.hilliard1@gmail.com> Link: https://patch.msgid.link/20261026-ptp-vclock-sampling-v6-4-e705612541f1@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux')
0 files changed, 0 insertions, 0 deletions