]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
vsock/test: fix test for null ptr deref when transport changes
authorStefano Garzarella <sgarzare@redhat.com>
Tue, 8 Jul 2025 11:17:01 +0000 (13:17 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 10 Jul 2025 02:33:07 +0000 (19:33 -0700)
commit5d6fc6b4d0b2aee373dba41a25ede2651769ac48
tree5f0edf217d857b38fd8b34b24bc560156ae792ed
parentb9274abe9803877ad36b28213d00eb414a9c0a95
vsock/test: fix test for null ptr deref when transport changes

In test_stream_transport_change_client(), the client sends CONTROL_CONTINUE
on each iteration, even when connect() is unsuccessful. This causes a flood
of control messages in the server that hangs around for more than 10
seconds after the test finishes, triggering several timeouts and causing
subsequent tests to fail. This was discovered in testing a newly proposed
test that failed in this way on the client side:
    ...
    33 - SOCK_STREAM transport change null-ptr-deref...ok
    34 - SOCK_STREAM ioctl(SIOCINQ) functionality...recv timed out

The CONTROL_CONTINUE message is used only to tell to the server to call
accept() to consume successful connections, so that subsequent connect()
will not fail for finding the queue full.

Send CONTROL_CONTINUE message only when the connect() has succeeded, or
found the queue full. Note that the second connect() can also succeed if
the first one was interrupted after sending the request.

Fixes: 3a764d93385c ("vsock/test: Add test for null ptr deref when transport changes")
Cc: leonardi@redhat.com
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Link: https://patch.msgid.link/20250708111701.129585-1-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/testing/vsock/vsock_test.c