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] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZtqEtVBEQQEp5gPV@hoboy.vegasvil.org>
Date: Thu, 5 Sep 2024 21:27:33 -0700
From: Richard Cochran <richardcochran@...il.com>
To: Jinjie Ruan <ruanjinjie@...wei.com>
Cc: bryan.whitehead@...rochip.com, davem@...emloft.net, edumazet@...gle.com,
	kuba@...nel.org, pabeni@...hat.com, UNGLinuxDriver@...rochip.com,
	andrew@...n.ch, netdev@...r.kernel.org
Subject: Re: [PATCH -next v2 1/2] ptp: Check timespec64 before call
 settime64()

On Fri, Sep 06, 2024 at 11:48:05AM +0800, Jinjie Ruan wrote:

> diff --git a/drivers/ptp/ptp_clock.c b/drivers/ptp/ptp_clock.c
> index c56cd0f63909..cf75899a6681 100644
> --- a/drivers/ptp/ptp_clock.c
> +++ b/drivers/ptp/ptp_clock.c
> @@ -100,6 +100,16 @@ static int ptp_clock_settime(struct posix_clock *pc, const struct timespec64 *tp
>  		return -EBUSY;
>  	}
>  
> +	if (!tp) {
> +		pr_warn("ptp: tp == NULL\n");
> +		return -EINVAL;
> +	}

This check is pointless because `tp` cannot be null.

See SYSCALL_DEFINE2(clock_settime, ...)

> +	if (!timespec64_valid(tp)) {
> +		pr_warn("ptp: tv_sec or tv_usec out of range\n");
> +		return -ERANGE;
> +	}

Shouldn't this be done at the higher layer, in clock_settime() ?

Thanks,
Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ