[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALs4sv0V7Tu9VKgopUZJZfQZA=B1ijnEA5jiqG47wvvsxpTrxA@mail.gmail.com>
Date: Tue, 28 Oct 2025 18:28:58 +0530
From: Pavan Chebbi <pavan.chebbi@...adcom.com>
To: Junjie Cao <junjie.cao@...el.com>
Cc: Richard Cochran <richardcochran@...il.com>, Andrew Lunn <andrew+netdev@...n.ch>,
"David S . Miller" <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com,
syzbot+c8c0e7ccabd456541612@...kaller.appspotmail.com
Subject: Re: [PATCH] ptp: guard ptp_clock_gettime() if neither gettimex64 nor
On Tue, Oct 28, 2025 at 3:22 PM Junjie Cao <junjie.cao@...el.com> wrote:
>
> Syzbot reports a NULL function pointer call on arm64 when
> ptp_clock_gettime() falls back to ->gettime64() and the driver provides
> neither ->gettimex64() nor ->gettime64(). This leads to a crash in the
> posix clock gettime path.
>
> Return -EOPNOTSUPP when both callbacks are missing, avoiding the crash
> and matching the defensive style used in the posix clock layer.
>
> Reported-by: syzbot+c8c0e7ccabd456541612@...kaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=c8c0e7ccabd456541612
> Signed-off-by: Junjie Cao <junjie.cao@...el.com>
> ---
> drivers/ptp/ptp_clock.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index ef020599b771..764bd25220c1 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -110,12 +110,14 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp
> static int ptp_clock_gettime(struct posix_clock *pc, struct timespec64 *tp)
> {
> struct ptp_clock *ptp = container_of(pc, struct ptp_clock, clock);
> - int err;
> + int err = -EOPNOTSUPP;
>
> if (ptp->info->gettimex64)
> - err = ptp->info->gettimex64(ptp->info, tp, NULL);
> - else
> - err = ptp->info->gettime64(ptp->info, tp);
> + return ptp->info->gettimex64(ptp->info, tp, NULL);
> +
> + if (ptp->info->gettime64)
> + return ptp->info->gettime64(ptp->info, tp);
> +
> return err;
> }
Patch looks valid to me. But a similar situation exists right above
this function where ptp_clock_settime() is calling
ptp->info->settime64() unconditionally.
Maybe that can be guarded also?
Also this looks like a patch meant for "net" with an improved title IMO.
>
> --
> 2.43.0
>
>
Download attachment "smime.p7s" of type "application/pkcs7-signature" (5469 bytes)
Powered by blists - more mailing lists