All of lore.kernel.org
 help / color / mirror / Atom feed
From: Vadim Fedorenko <vadim.fedorenko@linux.dev>
To: Tim Hostetler <thostet@google.com>, netdev@vger.kernel.org
Cc: richardcochran@gmail.com, andrew+netdev@lunn.ch,
	davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org, Kuniyuki Iwashima <kuniyu@google.com>,
	Harshitha Ramamurthy <hramamurthy@google.com>
Subject: Re: [PATCH net] ptp: Return -EINVAL on ptp_clock_register if required ops are NULL
Date: Tue, 4 Nov 2025 11:31:51 +0000	[thread overview]
Message-ID: <c8b2b414-149b-4f35-8333-43011804ea2a@linux.dev> (raw)
In-Reply-To: <20251030180832.388729-1-thostet@google.com>

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@vger.kernel.org
> Fixes: d7d38f5bd7be ("ptp: use the 64 bit get/set time methods for the posix clock.")
> Suggested-by: Kuniyuki Iwashima <kuniyu@google.com>
> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
> Reviewed-by: Harshitha Ramamurthy <hramamurthy@google.com>
> Signed-off-by: Tim Hostetler <thostet@google.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@linux.dev>

  parent reply	other threads:[~2025-11-04 11:31 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-30 18:08 [PATCH net] ptp: Return -EINVAL on ptp_clock_register if required ops are NULL Tim Hostetler
2025-11-01  0:38 ` Jakub Kicinski
2025-11-04 11:31 ` Vadim Fedorenko [this message]
2025-11-04 17:47   ` Tim Hostetler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c8b2b414-149b-4f35-8333-43011804ea2a@linux.dev \
    --to=vadim.fedorenko@linux.dev \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hramamurthy@google.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=richardcochran@gmail.com \
    --cc=stable@vger.kernel.org \
    --cc=thostet@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.