mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net] selftests: net: gro: fix OOB access when under-coalescing
@ 2026-09-16  1:00 Narcisa Vasile
  2026-09-17  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Narcisa Vasile @ 2026-09-16  1:00 UTC (permalink / raw)
  To: netdev, kuba, daniel.zahka, David S . Miller, Eric Dumazet,
	Paolo Abeni, Simon Horman, Shuah Khan, Willem de Bruijn,
	Petr Machata, Anubhav Singh, Richard Gobert, Coco Li
  Cc: linux-kselftest, linux-kernel, narcisav.kernel

When more packets than expected are received, num_pkt
could index beyond the end of the array. Add a check to prevent
OOB access.

Continue receiving until the FIN is received to obtain
the total packet count. This helps diagnose issues by
distinguishing the cases where no coalescing happened from
the partial-coalescing cases that didn't meet the test check.

Fixes: 7d1575014a63 ("selftests/net: GRO coalesce test")
Signed-off-by: Narcisa Vasile <narcisav.kernel@gmail.com>
---
 tools/testing/selftests/net/lib/gro.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/lib/gro.c b/tools/testing/selftests/net/lib/gro.c
index 7a333155de1a..85ba69eeb6aa 100644
--- a/tools/testing/selftests/net/lib/gro.c
+++ b/tools/testing/selftests/net/lib/gro.c
@@ -1211,7 +1211,8 @@ static void check_recv_pkts(int fd, int *correct_payload,
 				- sizeof(struct tcphdr) - sizeof(struct iphdr);
 		}
 		vlog("%d ", data_len);
-		if (data_len != correct_payload[num_pkt]) {
+		if (num_pkt < correct_num_pkts &&
+		    data_len != correct_payload[num_pkt]) {
 			vlog("[!=%d]", correct_payload[num_pkt]);
 			bad_packet = true;
 		}
-- 
2.53.0-Meta


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

* Re: [PATCH net] selftests: net: gro: fix OOB access when under-coalescing
  2026-09-16  1:00 [PATCH net] selftests: net: gro: fix OOB access when under-coalescing Narcisa Vasile
@ 2026-09-17  2:20 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-09-17  2:20 UTC (permalink / raw)
  To: Narcisa Vasile
  Cc: netdev, kuba, daniel.zahka, davem, edumazet, pabeni, horms,
	shuah, willemb, petrm, anubhavsinggh, richardbgobert, lixiaoyan,
	linux-kselftest, linux-kernel

Hello:

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

On Tue, 15 Sep 2026 18:00:29 -0700 you wrote:
> When more packets than expected are received, num_pkt
> could index beyond the end of the array. Add a check to prevent
> OOB access.
> 
> Continue receiving until the FIN is received to obtain
> the total packet count. This helps diagnose issues by
> distinguishing the cases where no coalescing happened from
> the partial-coalescing cases that didn't meet the test check.
> 
> [...]

Here is the summary with links:
  - [net] selftests: net: gro: fix OOB access when under-coalescing
    https://git.kernel.org/netdev/net-next/c/7bc21b740291

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] 2+ messages in thread

end of thread, other threads:[~2026-09-17  2:21 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-09-16  1:00 [PATCH net] selftests: net: gro: fix OOB access when under-coalescing Narcisa Vasile
2026-09-17  2:20 ` 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®