* [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime
@ 2024-11-25 10:59 Ajay Kaher
2024-11-26 4:39 ` Richard Cochran
2024-11-30 21:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Ajay Kaher @ 2024-11-25 10:59 UTC (permalink / raw)
To: richardcochran, netdev
Cc: linux-kernel, nick.shi, ajay.kaher, alexey.makhalov,
vasavi.sirnapalli, vamsi-krishna.brahmajosyula, florian.fainelli
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: 39a8cbd9ca05 ("ptp: remember the adjusted frequency")
Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com>
---
drivers/ptp/ptp_clock.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
index c56cd0f..77a36e7 100644
--- a/drivers/ptp/ptp_clock.c
+++ b/drivers/ptp/ptp_clock.c
@@ -150,7 +150,8 @@ static int ptp_clock_adjtime(struct posix_clock *pc, struct __kernel_timex *tx)
if (ppb > ops->max_adj || ppb < -ops->max_adj)
return -ERANGE;
err = ops->adjfine(ops, tx->freq);
- ptp->dialed_frequency = tx->freq;
+ if (!err)
+ ptp->dialed_frequency = tx->freq;
} else if (tx->modes & ADJ_OFFSET) {
if (ops->adjphase) {
s32 max_phase_adj = ops->getmaxphase(ops);
--
2.39.4
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime
2024-11-25 10:59 [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime Ajay Kaher
@ 2024-11-26 4:39 ` Richard Cochran
2024-11-30 21:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Richard Cochran @ 2024-11-26 4:39 UTC (permalink / raw)
To: Ajay Kaher
Cc: netdev, linux-kernel, nick.shi, alexey.makhalov,
vasavi.sirnapalli, vamsi-krishna.brahmajosyula, florian.fainelli
On Mon, Nov 25, 2024 at 10:59:54AM +0000, Ajay Kaher wrote:
> 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: 39a8cbd9ca05 ("ptp: remember the adjusted frequency")
> Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com>
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime
2024-11-25 10:59 [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime Ajay Kaher
2024-11-26 4:39 ` Richard Cochran
@ 2024-11-30 21:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-11-30 21:50 UTC (permalink / raw)
To: Ajay Kaher
Cc: richardcochran, netdev, linux-kernel, nick.shi, alexey.makhalov,
vasavi.sirnapalli, vamsi-krishna.brahmajosyula, florian.fainelli
Hello:
This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:
On Mon, 25 Nov 2024 10:59:54 +0000 you wrote:
> 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: 39a8cbd9ca05 ("ptp: remember the adjusted frequency")
> Signed-off-by: Ajay Kaher <ajay.kaher@broadcom.com>
>
> [...]
Here is the summary with links:
- ptp: Add error handling for adjfine callback in ptp_clock_adjtime
https://git.kernel.org/netdev/net/c/98337d7c8757
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-11-30 21:50 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-11-25 10:59 [PATCH] ptp: Add error handling for adjfine callback in ptp_clock_adjtime Ajay Kaher
2024-11-26 4:39 ` Richard Cochran
2024-11-30 21:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®