Junjie Cao
unread,Oct 28, 2025, 9:43:33 AM (3 days ago) Oct 28Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
  to Richard Cochran, Andrew Lunn, David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni, net...@vger.kernel.org, linux-...@vger.kernel.org, syzkall...@googlegroups.com, Junjie Cao, syzbot+c8c0e7...@syzkaller.appspotmail.com
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+c8c0e7...@syzkaller.appspotmail.com
Closes: 
https://syzkaller.appspot.com/bug?extid=c8c0e7ccabd456541612
Signed-off-by: Junjie Cao <
junji...@intel.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;
 }
 
-- 
2.43.0