]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
6.6-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jan 2026 10:01:05 +0000 (11:01 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 9 Jan 2026 10:01:05 +0000 (11:01 +0100)
added patches:
net-stmmac-make-sure-that-ptp_rate-is-not-0-before-configuring-est.patch

queue-6.6/net-stmmac-make-sure-that-ptp_rate-is-not-0-before-configuring-est.patch [new file with mode: 0644]
queue-6.6/series

diff --git a/queue-6.6/net-stmmac-make-sure-that-ptp_rate-is-not-0-before-configuring-est.patch b/queue-6.6/net-stmmac-make-sure-that-ptp_rate-is-not-0-before-configuring-est.patch
new file mode 100644 (file)
index 0000000..a31f290
--- /dev/null
@@ -0,0 +1,62 @@
+From cbefe2ffa7784525ec5d008ba87c7add19ec631a Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Alexis=20Lothor=C3=A9?= <alexis.lothore@bootlin.com>
+Date: Thu, 29 May 2025 11:07:24 +0200
+Subject: net: stmmac: make sure that ptp_rate is not 0 before configuring EST
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+From: Alexis LothorĂ© <alexis.lothore@bootlin.com>
+
+commit cbefe2ffa7784525ec5d008ba87c7add19ec631a upstream.
+
+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")
+  which is irrelevant to the logic of this patch. ]
+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        |    5 +++++
+ drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c |    5 +++++
+ 2 files changed, 10 insertions(+)
+
+--- a/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwmac5.c
+@@ -597,6 +597,11 @@ int dwmac5_est_configure(void __iomem *i
+       int i, ret = 0x0;
+       u32 ctrl;
++      if (!ptp_rate) {
++              pr_warn("Dwmac5: Invalid PTP rate");
++              return -EINVAL;
++      }
++
+       ret |= dwmac5_est_write(ioaddr, BTR_LOW, cfg->btr[0], false);
+       ret |= dwmac5_est_write(ioaddr, BTR_HIGH, cfg->btr[1], false);
+       ret |= dwmac5_est_write(ioaddr, TER, cfg->ter, false);
+--- a/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
++++ b/drivers/net/ethernet/stmicro/stmmac/dwxgmac2_core.c
+@@ -1537,6 +1537,11 @@ static int dwxgmac3_est_configure(void _
+       int i, ret = 0x0;
+       u32 ctrl;
++        if (!ptp_rate) {
++                pr_warn("Dwxgmac2: Invalid PTP rate");
++                return -EINVAL;
++        }
++
+       ret |= dwxgmac3_est_write(ioaddr, XGMAC_BTR_LOW, cfg->btr[0], false);
+       ret |= dwxgmac3_est_write(ioaddr, XGMAC_BTR_HIGH, cfg->btr[1], false);
+       ret |= dwxgmac3_est_write(ioaddr, XGMAC_TER, cfg->ter, false);
index 8d0737e6660b79a12d7766086ecc4140487b5c91..0910c1d7915cb09635c4e0562875b47edfe6525f 100644 (file)
@@ -729,3 +729,4 @@ mm-damon-tests-core-kunit-handle-alloc-failure-on-damon_test_set_attrs.patch
 mm-damon-tests-core-kunit-handle-alloc-failures-in-damon_test_update_monitoring_result.patch
 virtio_console-fix-order-of-fields-cols-and-rows.patch
 ext4-filesystems-without-casefold-feature-cannot-be-mounted-with-siphash.patch
+net-stmmac-make-sure-that-ptp_rate-is-not-0-before-configuring-est.patch