Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

selftests/bpf: Fix error checking on reading the tcp_fastopen sysctl

There is a typo in checking the "saved_tcp_fo" and instead
"saved_tcp_syncookie" is checked again. This patch fixes it
and also breaks them into separate if statements such that
the test will abort asap.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Andrii Nakryiko <andriin@fb.com>
Link: https://lore.kernel.org/bpf/20200211175910.3235321-1-kafai@fb.com

authored by

Martin KaFai Lau and committed by
Daniel Borkmann
2fe77100 30744a68

+3 -1
+3 -1
tools/testing/selftests/bpf/prog_tests/select_reuseport.c
··· 822 822 goto out; 823 823 824 824 saved_tcp_fo = read_int_sysctl(TCP_FO_SYSCTL); 825 + if (saved_tcp_fo < 0) 826 + goto out; 825 827 saved_tcp_syncookie = read_int_sysctl(TCP_SYNCOOKIE_SYSCTL); 826 - if (saved_tcp_syncookie < 0 || saved_tcp_syncookie < 0) 828 + if (saved_tcp_syncookie < 0) 827 829 goto out; 828 830 829 831 if (enable_fastopen())