From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Jordan Rhee <jordanrhee@google.com>
Cc: Harshitha Ramamurthy <hramamurthy@google.com>,
netdev@vger.kernel.org, joshwash@google.com,
andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, richardcochran@gmail.com,
thostet@google.com, ziweixiao@google.com, willemb@google.com,
nktgrg@google.com, pkaligineedi@google.com,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine
Date: Mon, 10 Aug 2026 17:15:25 +0100 [thread overview]
Message-ID: <ae8068c8-ece8-4c6b-9c0b-65d9cbedf84f@linux.dev> (raw)
In-Reply-To: <CA+mzVttPSW=NKqqBwY9kxdL_r0hKzQfu38eZtmfUB6iaeHcNRw@mail.gmail.com>
On 10/08/2026 16:55, Jordan Rhee wrote:
> On Sat, Aug 8, 2026 at 8:27 AM Vadim Fedorenko
> <vadim.fedorenko@linux.dev> wrote:
>>
>> On 07/08/2026 23:43, Harshitha Ramamurthy wrote:
>>> From: Jordan Rhee <jordanrhee@google.com>
>>>
>>> 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: stable@vger.kernel.org
>>> Fixes: acd16380523b ("gve: Add initial PTP device support")
>>> Signed-off-by: Jordan Rhee <jordanrhee@google.com>
>>> Signed-off-by: Harshitha Ramamurthy <hramamurthy@google.com>
>>> ---
>>> 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").
ah, yeah, I see that gve_ptp_gettimex64 is -EOPNOTSUPP.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
prev parent reply other threads:[~2026-08-10 16:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-07 22:43 [PATCH net 0/2] gve: Bug fixes for header-split and PTP Harshitha Ramamurthy
2026-08-07 22:43 ` [PATCH net 1/2] gve: fix zero-length skb frag with header-split Harshitha Ramamurthy
2026-08-07 22:43 ` [PATCH net 2/2] gve: fix NULL dereference due to missing ptp adjfine Harshitha Ramamurthy
2026-08-08 15:26 ` Vadim Fedorenko
2026-08-10 15:55 ` Jordan Rhee
2026-08-10 16:15 ` Vadim Fedorenko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ae8068c8-ece8-4c6b-9c0b-65d9cbedf84f@linux.dev \
--to=vadim.fedorenko@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hramamurthy@google.com \
--cc=jordanrhee@google.com \
--cc=joshwash@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nktgrg@google.com \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=richardcochran@gmail.com \
--cc=stable@vger.kernel.org \
--cc=thostet@google.com \
--cc=willemb@google.com \
--cc=ziweixiao@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox