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: <ead7487d-005d-4e04-b208-38c5f3b28cb3@redhat.com>
Date: Thu, 19 Jun 2025 15:31:48 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Rengarajan.S@...rochip.com, aleksei.kodanev@...l-sw.com,
 netdev@...r.kernel.org
Cc: andrew+netdev@...n.ch, Bryan.Whitehead@...rochip.com,
 davem@...emloft.net, Raju.Lakkaraju@...rochip.com, kuba@...nel.org,
 edumazet@...gle.com, UNGLinuxDriver@...rochip.com, richardcochran@...il.com
Subject: Re: [PATCH net-next v2] net: lan743x: fix potential out-of-bounds
 write in lan743x_ptp_io_event_clock_get()

On 6/19/25 12:39 PM, Rengarajan.S@...rochip.com wrote:
> On Mon, 2025-06-16 at 11:37 +0000, Alexey Kodanev wrote:
>> EXTERNAL EMAIL: Do not click links or open attachments unless you
>> know the content is safe
>>
>> 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@...l-sw.com>
>> ---
>>
>> v2: Increase LAN743X_PTP_N_EXTTS to 8
>>
>>  drivers/net/ethernet/microchip/lan743x_ptp.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/microchip/lan743x_ptp.h
>> b/drivers/net/ethernet/microchip/lan743x_ptp.h
>> index e8d073bfa2ca..f33dc83c5700 100644
>> --- a/drivers/net/ethernet/microchip/lan743x_ptp.h
>> +++ b/drivers/net/ethernet/microchip/lan743x_ptp.h
>> @@ -18,9 +18,9 @@
>>   */
>>  #define LAN743X_PTP_N_EVENT_CHAN       2
>>  #define LAN743X_PTP_N_PEROUT           LAN743X_PTP_N_EVENT_CHAN
>> -#define LAN743X_PTP_N_EXTTS            4
>> -#define LAN743X_PTP_N_PPS              0
>>  #define PCI11X1X_PTP_IO_MAX_CHANNELS   8
>> +#define LAN743X_PTP_N_EXTTS            PCI11X1X_PTP_IO_MAX_CHANNELS
>> +#define LAN743X_PTP_N_PPS              0
>>  #define PTP_CMD_CTL_TIMEOUT_CNT                50
> 
> Thanks for the update. Changing the LAN743X_PTP_N_EXTTS from 4 to 8
> looks valid here.
> 
>>
>>  struct lan743x_adapter;
>> --
>> 2.25.1
>>
> 
> Acked-by: Rengarajan S <rengarajan.s@...rochip.com>

Thanks!

FTR, I'm applying this patch to the 'net' tree as the issue is present
there since a while and the change itself does not fit net-next IMHO.

/P


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ