Re: [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine

Jordan Rhee <[email protected]>
Newsgroups org.kernel.vger.netdev,org.kernel.vger.linux-kernel,org.kernel.vger.stable
Message-ID <CA+mzVttPSW=NKqqBwY9kxdL_r0hKzQfu38eZtmfUB6iaeHcNRw@mail.gmail.com>
On Sat, Aug 8, 2026 at 8:27 AM Vadim Fedorenko
<[email protected]> wrote:
>
> On 07/08/2026 23:43, Harshitha Ramamurthy wrote:
> > From: Jordan Rhee <[email protected]>
> >
> > Fix NULL dereference due to missing implementation of adjfine, which can
> > be triggered from usermode as follows:
> >
> > sudo ./testptp -d /dev/ptp0 -f 0
> > [  551.943697] BUG: kernel NULL pointer dereference, address: 0000000000000000
> > [...]
> > [  552.061946] Call Trace:
> > [  552.064487]  <TASK>
> > [  552.066681]  ptp_clock_adjtime+0x1c0/0x2c0
> > [  552.070874]  ? get_clock_desc+0x6b/0xb0
> > [  552.074825]  pc_clock_adjtime+0x78/0xc0
> > [  552.078755]  __do_sys_clock_adjtime+0x85/0x110
> > [  552.083293]  do_syscall_64+0xea/0x610
> >
> > Cc: [email protected]
> > Fixes: acd16380523b ("gve: Add initial PTP device support")
> > Signed-off-by: Jordan Rhee <[email protected]>
> > Signed-off-by: Harshitha Ramamurthy <[email protected]>
> > ---
> >   drivers/net/ethernet/google/gve/gve_ptp.c | 6 ++++++
> >   1 file changed, 6 insertions(+)
> >
> > diff --git a/drivers/net/ethernet/google/gve/gve_ptp.c b/drivers/net/ethernet/google/gve/gve_ptp.c
> > index 06b1cf4a5efc..1d6c59f4ead3 100644
> > --- a/drivers/net/ethernet/google/gve/gve_ptp.c
> > +++ b/drivers/net/ethernet/google/gve/gve_ptp.c
> > @@ -26,6 +26,11 @@ int gve_clock_nic_ts_read(struct gve_priv *priv)
> >       return 0;
> >   }
> >
> > +static int gve_ptp_adjfine(struct ptp_clock_info *ptp, long scaled_ppm)
> > +{
> > +     return -EOPNOTSUPP;
> > +}
> > +
> >   static int gve_ptp_gettimex64(struct ptp_clock_info *info,
> >                             struct timespec64 *ts,
> >                             struct ptp_system_timestamp *sts)
> > @@ -60,6 +65,7 @@ static long gve_ptp_do_aux_work(struct ptp_clock_info *info)
> >   static const struct ptp_clock_info gve_ptp_caps = {
> >       .owner          = THIS_MODULE,
> >       .name           = "gve clock",
> > +     .adjfine        = gve_ptp_adjfine,
> >       .gettimex64     = gve_ptp_gettimex64,
> >       .settime64      = gve_ptp_settime64,
> >       .do_aux_work    = gve_ptp_do_aux_work,
>
> .adjtime has to be implemented as well - neither adjfine nor adjtime are
> checked within ptp_clock_adjtime()

adjtime() can only be reached if gettimex64() succeeds. Since GVE
currently returns -EOPNOTSUPP in gettimex64(), ptp_clock_adjtime()
will short circuit before calling the driver's adjtime callback. We
will need to provide a stub for adjtime() when we implement
gettimex64().

My understanding is that fixes should only address real, reproducible
issues which is why we only sent adjfine in this patch. If the
maintainers would prefer we send adjtime() as well, just let us know.
That said, our preference would be not to delay the other patch in
this series ("gve: fix zero-length skb frag with header-split").
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.