Skip to content
Snippets Groups Projects
Commit 7f5eda0e authored by Ajay Kaher's avatar Ajay Kaher Committed by Greg Kroah-Hartman
Browse files

ptp: Add error handling for adjfine callback in ptp_clock_adjtime


[ Upstream commit 98337d7c ]

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: 39a8cbd9 ("ptp: remember the adjusted frequency")
Signed-off-by: default avatarAjay Kaher <ajay.kaher@broadcom.com>
Acked-by: default avatarRichard Cochran <richardcochran@gmail.com>
Link: https://patch.msgid.link/20241125105954.1509971-1-ajay.kaher@broadcom.com


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent ad28612e
No related branches found
No related tags found
No related merge requests found
......@@ -146,7 +146,8 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
err = ops->adjfine(ops, tx->freq);
else
err = ops->adjfreq(ops, ppb);
ptp->dialed_frequency = tx->freq;
if (!err)
ptp->dialed_frequency = tx->freq;
} else if (tx->modes & ADJ_OFFSET) {
if (ops->adjphase) {
s32 offset = tx->offset;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment