From: Thomas Gleixner <tglx@linutronix.de>
To: Jakub Kicinski <kuba@kernel.org>, Jinjie Ruan <ruanjinjie@huawei.com>
Cc: bryan.whitehead@microchip.com, davem@davemloft.net,
edumazet@google.com, pabeni@redhat.com, anna-maria@linutronix.de,
frederic@kernel.org, richardcochran@gmail.com,
johnstul@us.ibm.com, UNGLinuxDriver@microchip.com,
jstultz@google.com, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 RESEND 1/2] posix-clock: Fix missing timespec64 check in pc_clock_settime()
Date: Wed, 16 Oct 2024 00:33:02 +0200 [thread overview]
Message-ID: <87v7xtc7z5.ffs@tglx> (raw)
In-Reply-To: <20241011125726.62c5dde7@kernel.org>
On Fri, Oct 11 2024 at 12:57, Jakub Kicinski wrote:
> On Wed, 9 Oct 2024 15:23:01 +0800 Jinjie Ruan wrote:
>> As Andrew pointed out, it will make sense that the PTP core
>> checked timespec64 struct's tv_sec and tv_nsec range before calling
>> ptp->info->settime64().
>>
>> As the man manual of clock_settime() said, if tp.tv_sec is negative or
>> tp.tv_nsec is outside the range [0..999,999,999], it should return EINVAL,
>> which include dynamic clocks which handles PTP clock, and the condition is
>> consistent with timespec64_valid(). As Thomas suggested, timespec64_valid()
>> only check the timespec is valid, but not ensure that the time is
>> in a valid range, so check it ahead using timespec64_valid_strict()
>> in pc_clock_settime() and return -EINVAL if not valid.
>>
>> There are some drivers that use tp->tv_sec and tp->tv_nsec directly to
>> write registers without validity checks and assume that the higher layer
>> has checked it, which is dangerous and will benefit from this, such as
>> hclge_ptp_settime(), igb_ptp_settime_i210(), _rcar_gen4_ptp_settime(),
>> and some drivers can remove the checks of itself.
>
> I'm guessing we can push this into 6.12-rc and the other patch into
> net-next. I'll toss it into net on Monday unless someone objects.
Can you folks please at least wait until the maintainers of the code in
question had a look ?
Thanks,
tglx
next prev parent reply other threads:[~2024-10-15 22:33 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-09 7:23 [PATCH v5 RESEND 0/2] posix-clock: Fix missing timespec64 check for PTP clock Jinjie Ruan
2024-10-09 7:23 ` [PATCH v5 RESEND 1/2] posix-clock: Fix missing timespec64 check in pc_clock_settime() Jinjie Ruan
2024-10-11 19:57 ` Jakub Kicinski
2024-10-15 22:33 ` Thomas Gleixner [this message]
2024-10-15 23:22 ` Jakub Kicinski
2024-10-16 14:52 ` Thomas Gleixner
2024-10-22 11:23 ` Pavel Machek
2024-10-22 14:31 ` Anna-Maria Behnsen
2024-10-09 7:23 ` [PATCH v5 RESEND 2/2] net: lan743x: Remove duplicate check Jinjie Ruan
2024-10-15 0:40 ` [PATCH v5 RESEND 0/2] posix-clock: Fix missing timespec64 check for PTP clock patchwork-bot+netdevbpf
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=87v7xtc7z5.ffs@tglx \
--to=tglx@linutronix.de \
--cc=UNGLinuxDriver@microchip.com \
--cc=anna-maria@linutronix.de \
--cc=bryan.whitehead@microchip.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=frederic@kernel.org \
--cc=johnstul@us.ibm.com \
--cc=jstultz@google.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=ruanjinjie@huawei.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).