]> 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>
Fri, 30 Jan 2026 06:01:31 +0000 (14:01 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2026 15:44:24 +0000 (16:44 +0100)
commitd6b0f7ed3e9b6c5e2e3a006c8f72c95aa4ac4b74
tree9dbbdfc4660c55f4f55bd9d84afb65874dd00c91
parentdd450b513718dfeb4c637c9335d51a55ebcd4320
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>
[ The context change is due to the commit c3f3b97238f6
("net: stmmac: Refactor EST implementation")
and the proper adoption is done. ]
Signed-off-by: Rahul Sharma <black.hawk@163.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/stmicro/stmmac/dwmac5.c
drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c