diff options
| author | Russell King (Oracle) <rmk+kernel@armlinux.org.uk> | 2026-02-25 13:01:19 +0300 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-02-27 04:35:48 +0300 |
| commit | 5c894879f17c70cd93712b30fa62e6803b1c46e2 (patch) | |
| tree | 8511124b3c93d297da9b62e99419f381f019c7eb /include/uapi/linux/android | |
| parent | 0314e382cf02983eb3c33ac537ad9701e7858bc9 (diff) | |
| download | linux-5c894879f17c70cd93712b30fa62e6803b1c46e2.tar.xz | |
net: stmmac: ptp: limit n_per_out
ptp_clock_ops.n_per_out sets the number of PPS outputs, which the PTP
subsystem uses to validate userspace input, such as the index number
used in a PTP_CLK_REQ_PEROUT request.
stmmac_enable() uses this to index the priv->pps array, which is an
array of size STMMAC_PPS_MAX. ptp_clock_ops.n_per_out is initialised
using priv->dma_cap.pps_out_num, which is a three bit field read from
hardware.
Documentation that I've checked suggests that values >= 5 are reserved,
but that doesn't mean such values won't appear, and if they do, we
can overrun the priv->pps array in stmmac_enable().
stmmac_ptp_register() has protection against this in its loop, but it
doesn't act to limit ptp_clock_ops.n_per_out.
Fix this by introducing a local variable, pps_out_num which is limited
to STMMAC_PPS_MAX, and use that when initialising the array and setting
priv->ptp_clock_ops.n_per_out. Print a warning when we limit the number
of outputs.
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
Link: https://patch.msgid.link/E1vvBhn-0000000ArCg-4C4u@rmk-PC.armlinux.org.uk
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/uapi/linux/android')
0 files changed, 0 insertions, 0 deletions
