From: <Rengarajan.S@microchip.com>
To: <aleksei.kodanev@bell-sw.com>, <netdev@vger.kernel.org>,
<pabeni@redhat.com>
Cc: <andrew+netdev@lunn.ch>, <Bryan.Whitehead@microchip.com>,
<davem@davemloft.net>, <Raju.Lakkaraju@microchip.com>,
<kuba@kernel.org>, <richardcochran@gmail.com>,
<edumazet@google.com>, <UNGLinuxDriver@microchip.com>
Subject: Re: [PATCH net-next v2] net: lan743x: fix potential out-of-bounds write in lan743x_ptp_io_event_clock_get()
Date: Thu, 19 Jun 2025 10:35:29 +0000 [thread overview]
Message-ID: <d201228a692312c3bb658bbc3e1865a3289a0684.camel@microchip.com> (raw)
In-Reply-To: <6a6eb40f-9790-460b-aeab-d6977c0371dc@redhat.com>
Hi Paolo,
On Thu, 2025-06-19 at 12:04 +0200, Paolo Abeni wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you
> know the content is safe
>
> On 6/16/25 1:37 PM, Alexey Kodanev wrote:
> > Before calling lan743x_ptp_io_event_clock_get(), the 'channel'
> > value
> > is checked against the maximum value of
> > PCI11X1X_PTP_IO_MAX_CHANNELS(8).
> > This seems correct and aligns with the PTP interrupt status
> > register
> > (PTP_INT_STS) specifications.
> >
> > However, lan743x_ptp_io_event_clock_get() writes to ptp->extts[]
> > with
> > only LAN743X_PTP_N_EXTTS(4) elements, using channel as an index:
> >
> > lan743x_ptp_io_event_clock_get(..., u8 channel,...)
> > {
> > ...
> > /* Update Local timestamp */
> > extts = &ptp->extts[channel];
> > extts->ts.tv_sec = sec;
> > ...
> > }
> >
> > To avoid an out-of-bounds write and utilize all the supported GPIO
> > inputs, set LAN743X_PTP_N_EXTTS to 8.
> >
> > Detected using the static analysis tool - Svace.
> > Fixes: 60942c397af6 ("net: lan743x: Add support for PTP-IO Event
> > Input External Timestamp (extts)")
> > Signed-off-by: Alexey Kodanev <aleksei.kodanev@bell-sw.com>
>
> @Rengarajan: I see you suggested this approach on V1, but it would be
> nice to have explicit ack here (or even better in this case tested-
> by)
Yes, I agree with the recent change made by Alexey to set
LAN743X_PTP_N_EXTTS to 8. I have tested this on my end using GPIO
numbers greater than 4 and did not encounter any issues. I will go
ahead and provide my acknowledgment for Alexey's patch.
Thanks,
Rengarajan S
>
> Thanks,
>
> Paolo
>
next prev parent reply other threads:[~2025-06-19 10:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 11:37 [PATCH net-next v2] net: lan743x: fix potential out-of-bounds write in lan743x_ptp_io_event_clock_get() Alexey Kodanev
2025-06-16 22:22 ` Jacob Keller
2025-06-19 10:04 ` Paolo Abeni
2025-06-19 10:26 ` Paolo Abeni
2025-06-19 10:35 ` Rengarajan.S [this message]
2025-06-19 10:39 ` Rengarajan.S
2025-06-19 13:31 ` Paolo Abeni
2025-06-19 13:50 ` 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=d201228a692312c3bb658bbc3e1865a3289a0684.camel@microchip.com \
--to=rengarajan.s@microchip.com \
--cc=Bryan.Whitehead@microchip.com \
--cc=Raju.Lakkaraju@microchip.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=aleksei.kodanev@bell-sw.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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.