selftests: net: gro: fix OOB access when under-coalescing
Subsystems (3)
PATCH 1/1 selftests: net: gro: fix OOB access when under-coalescing
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.
--- tools/testing/selftests/net/lib/gro.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/lib/gro.c +2 -1
@@ -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; }
Signature · 1 line
2.53.0-Meta
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 10 lines · On Tue, 15 Sep 2026 18:00:29 -0700 you wrote:
When more packets than expected are received,
num_pktcould 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!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html