[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c8b2b414-149b-4f35-8333-43011804ea2a@linux.dev>
Date: Tue, 4 Nov 2025 11:31:51 +0000
From: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
To: Tim Hostetler <thostet@...gle.com>, netdev@...r.kernel.org
Cc: richardcochran@...il.com, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com,
linux-kernel@...r.kernel.org, stable@...r.kernel.org,
Kuniyuki Iwashima <kuniyu@...gle.com>,
Harshitha Ramamurthy <hramamurthy@...gle.com>
Subject: Re: [PATCH net] ptp: Return -EINVAL on ptp_clock_register if required
ops are NULL
On 30/10/2025 18:08, Tim Hostetler wrote:
> ptp_clock should never be registered unless it stubs one of gettimex64()
> or gettime64() and settime64(). WARN_ON_ONCE and error out if either set
> of function pointers is null.
>
> Cc: stable@...r.kernel.org
> Fixes: d7d38f5bd7be ("ptp: use the 64 bit get/set time methods for the posix clock.")
> Suggested-by: Kuniyuki Iwashima <kuniyu@...gle.com>
> Reviewed-by: Kuniyuki Iwashima <kuniyu@...gle.com>
> Reviewed-by: Harshitha Ramamurthy <hramamurthy@...gle.com>
> Signed-off-by: Tim Hostetler <thostet@...gle.com>
> ---
> drivers/ptp/ptp_clock.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index ef020599b771..0bc79076771b 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -325,6 +325,10 @@ struct ptp_clock *ptp_clock_register(struct ptp_clock_info *info,
> if (info->n_alarm > PTP_MAX_ALARMS)
> return ERR_PTR(-EINVAL);
>
> + if (WARN_ON_ONCE((!info->gettimex64 && !info->gettime64) ||
> + !info->settime64))
> + return ERR_PTR(-EINVAL);
> +
> /* Initialize a clock structure. */
> ptp = kzalloc(sizeof(struct ptp_clock), GFP_KERNEL);
> if (!ptp) {
The patch itself LGTM, but I believe it should be targeted to net-next,
as it doesn't actually fix any problem with GVE patches landed net tree
already.
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@...ux.dev>
Powered by blists - more mailing lists