Re: [PATCH net v1] ptp: fix NULL deref when adjtime/adjfine are missing
From: Vadim Fedorenko
Date: Wed Aug 26 2026 - 08:24:35 EST
On 26/08/2026 11:10, Xuanqiang Luo wrote:
From: Xuanqiang Luo <luoxuanqiang@xxxxxxxxxx>
ptp_clock_adjtime() invokes ->adjtime and ->adjfine unconditionally,
but both callbacks are optional.
Could you please link to the source of this statement?
clock_adjtime() with ADJ_SETOFFSET
or ADJ_FREQUENCY therefore oopses on a PHC that implements neither.
iavf registers such a read-only clock: no adjtime/adjfine, and
max_adj left at 0. ADJ_SETOFFSET hits the NULL ->adjtime after the
offset is validated. ADJ_FREQUENCY with freq 0 converts to 0 ppb,
passes the max_adj check, and hits the NULL ->adjfine.
Return -EOPNOTSUPP when the requested callback is missing, as the
adjphase path already does, rather than adding driver stubs.
If PHC does not implement adjtime/adjfine/adjphase then it is a free-
running clock. ptp_clock_adjtime() has the check for such clocks.
To properly fix core part we have to extend ptp_clock and/or
ptp_clock_info to properly signal that registered clock is
free-running/read-only.