diff options
| author | Alexey Kodanev <[email protected]> | 2025-06-16 11:37:43 +0000 |
|---|---|---|
| committer | Paolo Abeni <[email protected]> | 2025-06-19 13:32:14 +0000 |
| commit | e353b0854d3a1a31cb061df8d022fbfea53a0f24 (patch) | |
| tree | 716aaa1892d66c0cab4415ade729e75a51340add /tools/net/ynl/pyynl/lib/ynl.py | |
| parent | eth: fbnic: avoid double free when failing to DMA-map FW msg (diff) | |
| download | kernel-e353b0854d3a1a31cb061df8d022fbfea53a0f24.tar.gz kernel-e353b0854d3a1a31cb061df8d022fbfea53a0f24.zip | |
net: lan743x: fix potential out-of-bounds write in lan743x_ptp_io_event_clock_get()
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 <[email protected]>
Reviewed-by: Jacob Keller <[email protected]>
Acked-by: Rengarajan S <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'tools/net/ynl/pyynl/lib/ynl.py')
0 files changed, 0 insertions, 0 deletions
