[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250109224246.1866690-1-sean.anderson@linux.dev>
Date: Thu, 9 Jan 2025 17:42:46 -0500
From: Sean Anderson <sean.anderson@...ux.dev>
To: Radhey Shyam Pandey <radhey.shyam.pandey@....com>,
Shannon Nelson <shannon.nelson@....com>,
"David S . Miller" <davem@...emloft.net>,
Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>,
Paolo Abeni <pabeni@...hat.com>,
netdev@...r.kernel.org
Cc: Michal Simek <michal.simek@....com>,
Simon Horman <horms@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Andy Chiu <andy.chiu@...ive.com>,
linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org,
Sean Anderson <sean.anderson@...ux.dev>
Subject: [PATCH net v3] net: xilinx: axienet: Fix IRQ coalescing packet count overflow
If coalece_count is greater than 255 it will not fit in the register and
will overflow. This can be reproduced by running
# ethtool -C ethX rx-frames 256
which will result in a timeout of 0us instead. Fix this by checking for
invalid values and reporting an error.
Signed-off-by: Sean Anderson <sean.anderson@...ux.dev>
Fixes: 8a3b7a252dca ("drivers/net/ethernet/xilinx: added Xilinx AXI Ethernet driver")
---
Changes in v3:
- Validate and reject instead of silently clamping
Changes in v2:
- Use FIELD_MAX to extract the max value from the mask
- Expand the commit message with an example on how to reproduce this
issue
drivers/net/ethernet/xilinx/xilinx_axienet_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
index 0f4b02fe6f85..c2991aeccf2b 100644
--- a/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
+++ b/drivers/net/ethernet/xilinx/xilinx_axienet_main.c
@@ -2056,6 +2056,12 @@ axienet_ethtools_set_coalesce(struct net_device *ndev,
return -EBUSY;
}
+ if (ecoalesce->rx_max_coalesced_frames > 255 ||
+ ecoalesce->rx_max_coalesced_frames > 255) {
+ NL_SET_ERR_MSG(extack, "frames must be less than 256");
+ return -EINVAL;
+ }
+
if (ecoalesce->rx_max_coalesced_frames)
lp->coalesce_count_rx = ecoalesce->rx_max_coalesced_frames;
if (ecoalesce->rx_coalesce_usecs)
--
2.35.1.1320.gc452695387.dirty
Powered by blists - more mailing lists