[PATCH net v1] iavf: add missing PTP adjustment callbacks
Romanowski, Rafal
rafal.romanowski at intel.com
Fri Sep 18 11:33:46 UTC 2026
> -----Original Message-----
> From: Jacob Keller <jacob.e.keller at intel.com>
> Sent: Monday, August 31, 2026 11:58 PM
> To: Vadim Fedorenko <vadim.fedorenko at linux.dev>; Xuanqiang Luo
> <xuanqiang.luo at linux.dev>; netdev at vger.kernel.org
> Cc: intel-wired-lan at lists.osuosl.org; richardcochran at gmail.com; Nguyen,
> Anthony L <anthony.l.nguyen at intel.com>; Kitszel, Przemyslaw
> <przemyslaw.kitszel at intel.com>; ahmed.zaki at intel.com;
> mateusz.polchlopek at intel.com; saikrishnag at marvell.com;
> andrew+netdev at lunn.ch; davem at davemloft.net; edumazet at google.com;
> kuba at kernel.org; pabeni at redhat.com; Xuanqiang Luo
> <luoxuanqiang at kylinos.cn>; stable at vger.kernel.org
> Subject: Re: [PATCH net v1] iavf: add missing PTP adjustment callbacks
>
> On 8/28/2026 2:10 AM, Vadim Fedorenko wrote:
> > On 28/08/2026 02:58, Xuanqiang Luo wrote:
> >> From: Xuanqiang Luo <luoxuanqiang at kylinos.cn>
> >>
> >> The PTP hardware clock documentation requires drivers to implement
> >> all callbacks and return -EOPNOTSUPP for unsupported features.
> >>
> >> The iavf driver registers a PHC without adjtime or adjfine callbacks.
> >> A userspace clock_adjtime(2) request reaches ptp_clock_adjtime(),
> >> where ADJ_SETOFFSET calls adjtime and ADJ_FREQUENCY calls adjfine.
> >> The missing callbacks can therefore cause a NULL dereference.
> >>
> >> Provide both callbacks and return -EOPNOTSUPP for the unsupported
> >> operations.
> >>
> >> Fixes: d734223b2f0d ("iavf: add initial framework for registering PTP
> >> clock")
> >> Link:
> >> https://docs.kernel.org/driver-api/ptp.html#writing-clock-drivers
> >> Link: https://lore.kernel.org/all/20260826101004.100979-1-
> >> xuanqiang.luo at linux.dev/
> >> Cc: stable at vger.kernel.org
> >> Signed-off-by: Xuanqiang Luo <luoxuanqiang at kylinos.cn>
>
> Acked-by: Jacob Keller <jacob.e.keller at intel.com>
>
> >> ---
> >> drivers/net/ethernet/intel/iavf/iavf_ptp.c | 12 ++++++++++++
> >> 1 file changed, 12 insertions(+)
> >>
> >> diff --git a/drivers/net/ethernet/intel/iavf/iavf_ptp.c
> >> b/drivers/net/ ethernet/intel/iavf/iavf_ptp.c index
> >> 87b97e09df14a..fcb273828bc1b 100644
> >> --- a/drivers/net/ethernet/intel/iavf/iavf_ptp.c
> >> +++ b/drivers/net/ethernet/intel/iavf/iavf_ptp.c
> >> @@ -252,6 +252,16 @@ static int iavf_ptp_gettimex64(struct
> >> ptp_clock_info *info,
> >> return iavf_read_phc_indirect(adapter, ts, sts);
> >> }
> >> +static int iavf_ptp_adjfine(struct ptp_clock_info *info, long
> >> scaled_ppm)
> >> +{
> >> + return -EOPNOTSUPP;
> >> +}
> >> +
> >> +static int iavf_ptp_adjtime(struct ptp_clock_info *info, s64 delta)
> >> +{
> >> + return -EOPNOTSUPP;
> >> +}
> >> +
> >> static int iavf_ptp_settime64(struct ptp_clock_info *info,
> >> const struct timespec64 *ts)
> >> {
> >> @@ -326,6 +336,8 @@ static int iavf_ptp_register_clock(struct
> >> iavf_adapter *adapter)
> >> KBUILD_MODNAME, dev_name(dev));
> >> ptp_info->owner = THIS_MODULE;
> >> ptp_info->gettimex64 = iavf_ptp_gettimex64;
> >> + ptp_info->adjfine = iavf_ptp_adjfine;
> >> + ptp_info->adjtime = iavf_ptp_adjtime;
> >> ptp_info->settime64 = iavf_ptp_settime64;
> >> ptp_info->do_aux_work = iavf_ptp_do_aux_work;
> >>
> > Reviewed-by: Vadim Fedorenko <vadim.fedorenko at linux.dev>
Tested-by: Rafal Romanowski <rafal.romanowski at intel.com>
More information about the Intel-wired-lan
mailing list