summaryrefslogtreecommitdiffstats
path: root/net/ipv4/udp.c
diff options
context:
space:
mode:
authorMartin KaFai Lau <martin.lau@kernel.org>2024-01-12 11:05:28 -0800
committerAlexei Starovoitov <ast@kernel.org>2024-01-13 11:01:44 -0800
commit19ca0823f6eaad01d18f664a00550abe912c034c (patch)
treef3b56edf62d964d24064b1ffb659697cb71f2408 /net/ipv4/udp.c
parent894d7508316e7ad722df597d68b4b1797a9eee11 (diff)
downloadlinux-stable-19ca0823f6eaad01d18f664a00550abe912c034c.tar.gz
linux-stable-19ca0823f6eaad01d18f664a00550abe912c034c.tar.bz2
linux-stable-19ca0823f6eaad01d18f664a00550abe912c034c.zip
bpf: iter_udp: Retry with a larger batch size without going back to the previous bucket
The current logic is to use a default size 16 to batch the whole bucket. If it is too small, it will retry with a larger batch size. The current code accidentally does a state->bucket-- before retrying. This goes back to retry with the previous bucket which has already been done. This patch fixed it. It is hard to create a selftest. I added a WARN_ON(state->bucket < 0), forced a particular port to be hashed to the first bucket, created >16 sockets, and observed the for-loop went back to the "-1" bucket. Cc: Aditi Ghag <aditi.ghag@isovalent.com> Fixes: c96dac8d369f ("bpf: udp: Implement batching for sockets iterator") Acked-by: Yonghong Song <yonghong.song@linux.dev> Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org> Reviewed-by: Aditi Ghag <aditi.ghag@isovalent.com> Link: https://lore.kernel.org/r/20240112190530.3751661-2-martin.lau@linux.dev Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'net/ipv4/udp.c')
-rw-r--r--net/ipv4/udp.c1
1 files changed, 0 insertions, 1 deletions
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 5f742d0b9e07..79050d83e736 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -3213,7 +3213,6 @@ again:
/* After allocating a larger batch, retry one more time to grab
* the whole bucket.
*/
- state->bucket--;
goto again;
}
done: