Skip to content

Commit 61c0142

Browse files
committed
bpf: iter_udp: Retry with a larger batch size without going back to the previous bucket
JIRA: https://issues.redhat.com/browse/RHEL-65787 commit 19ca082 Author: Martin KaFai Lau <martin.lau@kernel.org> Date: Fri Jan 12 11:05:28 2024 -0800 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: c96dac8 ("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> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.com>
1 parent e08ca1e commit 61c0142

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

net/ipv4/udp.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3256,7 +3256,6 @@ static struct sock *bpf_iter_udp_batch(struct seq_file *seq)
32563256
/* After allocating a larger batch, retry one more time to grab
32573257
* the whole bucket.
32583258
*/
3259-
state->bucket--;
32603259
goto again;
32613260
}
32623261
done:

0 commit comments

Comments
 (0)