selftests: net: reuseport_dualstack: fix uninitalized parameter
Subsystems (3)
PATCH 1/1 selftests: net: reuseport_dualstack: fix uninitalized parameter
This test reports EINVAL for getsockopt(SOL_SOCKET, SO_DOMAIN) occasionally due to the uninitialized length parameter. Initialize it to fix this, and also use int for "test_family" to comply with the API standard.
Fixes d6a61f80b871 ("soreuseport: test mixed v4/v6 sockets")
Reported-by Maciej Żenczykowski <[email protected]>
Signed-off-by Eric Dumazet <[email protected]>
Signed-off-by Wei Wang <[email protected]>
Cc Craig Gallek <[email protected]>
--- tools/testing/selftests/net/reuseport_dualstack.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
tools/testing/selftests/net/reuseport_dualstack.c +2 -1
@@ -129,7 +129,7 @@ static void test(int *rcv_fds, int count, int proto) {struct epoll_event ev;int epfd, i, test_fd; -uint16_t test_family; +int test_family;socklen_t len; epfd =epoll_create (1 );
@@ -146,6 +146,7 @@ static void test(int *rcv_fds, int count, int proto)send_from_v4 (proto); test_fd =receive_once (epfd, proto); + len =sizeof (test_family);if (getsockopt (test_fd,SOL_SOCKET ,SO_DOMAIN , &test_family, &len))error (1 , errno,"failed to read socket domain" );if (test_family !=AF_INET )
Signature · 1 line
2.24.0.rc0.303.g954a862665-goog
David Miller
maintainerFrom: Wei Wang <[email protected]>
Date: Thu, 31 Oct 2019 16:24:36 -0700
Quoted 10 lines
This test reports EINVAL for
getsockopt(SOL_SOCKET, SO_DOMAIN)occasionally due to the uninitialized length parameter. Initialize it to fix this, and also use int for "test_family" to comply with the API standard.Fixes d6a61f80b871 ("soreuseport: test mixed v4/v6 sockets")Reported-by Maciej Żenczykowski <[email protected]>Signed-off-by Eric Dumazet <[email protected]>Signed-off-by Wei Wang <[email protected]>Cc Craig Gallek <[email protected]>
Applied and queued up for -stable.