lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251031173811.63bfb9e0@kernel.org>
Date: Fri, 31 Oct 2025 17:38:11 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tim Hostetler <thostet@...gle.com>
Cc: netdev@...r.kernel.org, richardcochran@...il.com, andrew+netdev@...n.ch,
 davem@...emloft.net, edumazet@...gle.com, 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 Thu, 30 Oct 2025 11:08:32 -0700 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.")

This needs to go to net-next without the tags above.
The check can only help with new drivers, old ones _must_ be fixed 
like gve was. Not registering a driver is a regression.

> 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)

->n_alarm check is also input validation, you should probably fold it
into your new WARN_ON_ONCE(). Either that or remove the WARN_ON_ONCE()
annotation below. As is the checks are inconsistent.

>  		return ERR_PTR(-EINVAL);
>  
> +	if (WARN_ON_ONCE((!info->gettimex64 && !info->gettime64) ||
> +			 !info->settime64))
> +		return ERR_PTR(-EINVAL);
> +

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ