* [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error"
@ 2025-12-19 6:22 Anshumali Gaur
2025-12-29 15:49 ` Paolo Abeni
2025-12-29 15:50 ` patchwork-bot+netdevbpf
0 siblings, 2 replies; 3+ messages in thread
From: Anshumali Gaur @ 2025-12-19 6:22 UTC (permalink / raw)
To: netdev, linux-kernel
Cc: Anshumali Gaur, Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep,
hariprasad, Bharat Bhushan, Andrew Lunn, David S. Miller,
Eric Dumazet, Jakub Kicinski, Paolo Abeni, Christina Jacob
This patch ensures that the RX ring size (rx_pending) is not
set below the permitted length. This avoids UBSAN
shift-out-of-bounds errors when users passes small or zero
ring sizes via ethtool -G.
Fixes: d45d8979840d ("octeontx2-pf: Add basic ethtool support")
Signed-off-by: Anshumali Gaur <agaur@marvell.com>
Change-Id: I6de6770dbc0dd952725ccd71ce521f801bc7b15b
---
drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
index b90e23dc49de..b6449f0a9e7d 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_ethtool.c
@@ -418,6 +418,14 @@ static int otx2_set_ringparam(struct net_device *netdev,
*/
if (rx_count < pfvf->hw.rq_skid)
rx_count = pfvf->hw.rq_skid;
+
+ if (ring->rx_pending < 16) {
+ netdev_err(netdev,
+ "rx ring size %u invalid, min is 16\n",
+ ring->rx_pending);
+ return -EINVAL;
+ }
+
rx_count = Q_COUNT(Q_SIZE(rx_count, 3));
/* Due pipelining impact minimum 2000 unused SQ CQE's
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error"
2025-12-19 6:22 [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error" Anshumali Gaur
@ 2025-12-29 15:49 ` Paolo Abeni
2025-12-29 15:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: Paolo Abeni @ 2025-12-29 15:49 UTC (permalink / raw)
To: Anshumali Gaur, netdev, linux-kernel
Cc: Sunil Goutham, Geetha sowjanya, Subbaraya Sundeep, hariprasad,
Bharat Bhushan, Andrew Lunn, David S. Miller, Eric Dumazet,
Jakub Kicinski, Christina Jacob
On 12/19/25 7:22 AM, Anshumali Gaur wrote:
> This patch ensures that the RX ring size (rx_pending) is not
> set below the permitted length. This avoids UBSAN
> shift-out-of-bounds errors when users passes small or zero
> ring sizes via ethtool -G.
>
> Fixes: d45d8979840d ("octeontx2-pf: Add basic ethtool support")
> Signed-off-by: Anshumali Gaur <agaur@marvell.com>
> Change-Id: I6de6770dbc0dd952725ccd71ce521f801bc7b15b
Please strip the above tag in future submissions.
Thanks,
Paolo
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error"
2025-12-19 6:22 [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error" Anshumali Gaur
2025-12-29 15:49 ` Paolo Abeni
@ 2025-12-29 15:50 ` patchwork-bot+netdevbpf
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-12-29 15:50 UTC (permalink / raw)
To: Anshumali Gaur
Cc: netdev, linux-kernel, sgoutham, gakula, sbhatta, hkelam,
bbhushan2, andrew+netdev, davem, edumazet, kuba, pabeni, cjacob
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <pabeni@redhat.com>:
On Fri, 19 Dec 2025 11:52:26 +0530 you wrote:
> This patch ensures that the RX ring size (rx_pending) is not
> set below the permitted length. This avoids UBSAN
> shift-out-of-bounds errors when users passes small or zero
> ring sizes via ethtool -G.
>
> Fixes: d45d8979840d ("octeontx2-pf: Add basic ethtool support")
> Signed-off-by: Anshumali Gaur <agaur@marvell.com>
> Change-Id: I6de6770dbc0dd952725ccd71ce521f801bc7b15b
>
> [...]
Here is the summary with links:
- octeontx2-pf: fix "UBSAN: shift-out-of-bounds error"
https://git.kernel.org/netdev/net/c/85f4b0c650d9
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-29 15:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-19 6:22 [PATCH] octeontx2-pf: fix "UBSAN: shift-out-of-bounds error" Anshumali Gaur
2025-12-29 15:49 ` Paolo Abeni
2025-12-29 15:50 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).