]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: stmmac: make sure that ptp_rate is not 0 before configuring EST
authorAlexis Lothoré <alexis.lothore@bootlin.com>
Thu, 29 May 2025 09:07:24 +0000 (11:07 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 19 Jun 2025 13:32:17 +0000 (15:32 +0200)
commit451ee661d0f6272017fa012f99617101aa8ddf2c
tree44fdf4799b088a235d83126cb1be9e86d97468ac
parentbb033c6781ce1b0264c3993b767b4aa9021959c2
net: stmmac: make sure that ptp_rate is not 0 before configuring EST

[ Upstream commit cbefe2ffa7784525ec5d008ba87c7add19ec631a ]

If the ptp_rate recorded earlier in the driver happens to be 0, this
bogus value will propagate up to EST configuration, where it will
trigger a division by 0.

Prevent this division by 0 by adding the corresponding check and error
code.

Suggested-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Alexis Lothoré <alexis.lothore@bootlin.com>
Fixes: 8572aec3d0dc ("net: stmmac: Add basic EST support for XGMAC")
Link: https://patch.msgid.link/20250529-stmmac_tstamp_div-v4-2-d73340a794d5@bootlin.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/ethernet/stmicro/stmmac/stmmac_est.c