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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3815e749-a642-d5f3-7503-ee9d04a63938@huawei.com>
Date: Fri, 6 Sep 2024 14:37:58 +0800
From: Jinjie Ruan <ruanjinjie@...wei.com>
To: Richard Cochran <richardcochran@...il.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 2024/9/6 12:27, Richard Cochran wrote:
> 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.

Yes, this one is unnecessary and it is also unnecessary in the
lan743x_ptpci_settime64().

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

Maybe it is more reasonable?

> 
> Thanks,
> Richard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ