Skip to content

Commit c120c5f

Browse files
author
CKI Backport Bot
committed
ptp: Add error handling for adjfine callback in ptp_clock_adjtime
JIRA: https://issues.redhat.com/browse/RHEL-74024 commit 98337d7 Author: Ajay Kaher <ajay.kaher@broadcom.com> Date: Mon Nov 25 10:59:54 2024 +0000 ptp: Add error handling for adjfine callback in ptp_clock_adjtime ptp_clock_adjtime sets ptp->dialed_frequency even when adjfine callback returns an error. This causes subsequent reads to return an incorrect value. Fix this by adding error check before ptp->dialed_frequency is set. Fixes: 39a8cbd ("ptp: remember the adjusted frequency") Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Link: https://patch.msgid.link/20241125105954.1509971-1-ajay.kaher@broadcom.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent d92558a commit c120c5f

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/ptp/ptp_clock.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,8 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
150150
if (ppb > ops->max_adj || ppb < -ops->max_adj)
151151
return -ERANGE;
152152
err = ops->adjfine(ops, tx->freq);
153-
ptp->dialed_frequency = tx->freq;
153+
if (!err)
154+
ptp->dialed_frequency = tx->freq;
154155
} else if (tx->modes & ADJ_OFFSET) {
155156
if (ops->adjphase) {
156157
s32 max_phase_adj = ops->getmaxphase(ops);

0 commit comments

Comments
 (0)