mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity
@ 2026-08-20  5:54 Ratheesh Kannoth
  2026-08-24 18:31 ` Jakub Kicinski
  2026-08-24 18:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Ratheesh Kannoth @ 2026-08-20  5:54 UTC (permalink / raw)
  To: kuba, linux-kernel, netdev, rkannoth, sumang
  Cc: andrew+netdev, davem, edumazet, pabeni, sgoutham, Anshumali Gaur

From: Anshumali Gaur <agaur@marvell.com>

rvu_register_interrupts() walks every MSI-X vector and uses strstr()
to match "Mbox" or "FLR" in irq_name before pinning those interrupts
to CPU 0. irq_name is a per-vector NAME_SIZE buffer, but not every
slot is populated before this loop runs. strstr() keeps scanning until
it finds a NUL terminator, so an uninitialized slot can trigger a KASAN
slab-out-of-bounds read at boot when debug options are enabled.

Use strnstr() with NAME_SIZE to bound the search within each vector's
name buffer.

Fixes: 4e527f1e5c15 ("octeontx2-af: npc: cn20k: Add new mailboxes for CN20K silicon")
Signed-off-by: Anshumali Gaur <agaur@marvell.com>
Signed-off-by: Ratheesh Kannoth <rkannoth@marvell.com>
---
 drivers/net/ethernet/marvell/octeontx2/af/rvu.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
index ffba56ee8a60..43062390aa4c 100644
--- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
+++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c
@@ -3331,8 +3331,8 @@ static int rvu_register_interrupts(struct rvu *rvu)
 		goto fail;
 
 	for (i = 0; i < rvu->num_vec; i++) {
-		if (strstr(&rvu->irq_name[i * NAME_SIZE], "Mbox") ||
-		    strstr(&rvu->irq_name[i * NAME_SIZE], "FLR"))
+		if (strnstr(&rvu->irq_name[i * NAME_SIZE], "Mbox", NAME_SIZE) ||
+		    strnstr(&rvu->irq_name[i * NAME_SIZE], "FLR", NAME_SIZE))
 			irq_set_affinity(pci_irq_vector(rvu->pdev, i),
 					 cpumask_of(0));
 	}
-- 
2.43.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity
  2026-08-20  5:54 [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity Ratheesh Kannoth
@ 2026-08-24 18:31 ` Jakub Kicinski
  2026-08-24 18:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Jakub Kicinski @ 2026-08-24 18:31 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: linux-kernel, netdev, sumang, andrew+netdev, davem, edumazet,
	pabeni, sgoutham, Anshumali Gaur

On Thu, 20 Aug 2026 11:24:51 +0530 Ratheesh Kannoth wrote:
> rvu_register_interrupts() walks every MSI-X vector and uses strstr()
> to match "Mbox" or "FLR" in irq_name before pinning those interrupts
> to CPU 0. irq_name is a per-vector NAME_SIZE buffer, but not every
> slot is populated before this loop runs. strstr() keeps scanning until
> it finds a NUL terminator, so an uninitialized slot can trigger a KASAN
> slab-out-of-bounds read at boot when debug options are enabled.
> 
> Use strnstr() with NAME_SIZE to bound the search within each vector's
> name buffer.

String search for this sort of type tracking in C is a.. brave choice :/
But whatever..

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity
  2026-08-20  5:54 [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity Ratheesh Kannoth
  2026-08-24 18:31 ` Jakub Kicinski
@ 2026-08-24 18:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-08-24 18:40 UTC (permalink / raw)
  To: Ratheesh Kannoth
  Cc: kuba, linux-kernel, netdev, sumang, andrew+netdev, davem,
	edumazet, pabeni, sgoutham, agaur

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Thu, 20 Aug 2026 11:24:51 +0530 you wrote:
> From: Anshumali Gaur <agaur@marvell.com>
> 
> rvu_register_interrupts() walks every MSI-X vector and uses strstr()
> to match "Mbox" or "FLR" in irq_name before pinning those interrupts
> to CPU 0. irq_name is a per-vector NAME_SIZE buffer, but not every
> slot is populated before this loop runs. strstr() keeps scanning until
> it finds a NUL terminator, so an uninitialized slot can trigger a KASAN
> slab-out-of-bounds read at boot when debug options are enabled.
> 
> [...]

Here is the summary with links:
  - [net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity
    https://git.kernel.org/netdev/net/c/4d5df98369c5

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:[~2026-08-24 18:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-08-20  5:54 [PATCH net] octeontx2-af: fix out-of-bounds read setting MSI-X irq affinity Ratheesh Kannoth
2026-08-24 18:31 ` Jakub Kicinski
2026-08-24 18:40 ` 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

all inboxes | Powered by JetHome®