]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vsock/test: fix send_buf()/recv_buf() EINTR handling
authorStefano Garzarella <sgarzare@redhat.com>
Fri, 3 Apr 2026 09:32:51 +0000 (11:32 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Apr 2026 11:30:40 +0000 (13:30 +0200)
commitc99bcb566ce963bb094371185c5e0b021ab85854
tree8ed63d6ebeaacae041d64ca6e11e8734b798b27c
parentb2f4daa6422fd6cc0cec969794dab4a88ea4cea1
vsock/test: fix send_buf()/recv_buf() EINTR handling

[ Upstream commit 24ad7ff668896325591fa0b570f2cca6c55f136f ]

When send() or recv() returns -1 with errno == EINTR, the code skips
the break but still adds the return value to nwritten/nread, making it
decrease by 1. This leads to wrong buffer offsets and wrong bytes count.

Fix it by explicitly continuing the loop on EINTR, so the return value
is only added when it is positive.

Fixes: a8ed71a27ef5 ("vsock/test: add recv_buf() utility function")
Fixes: 12329bd51fdc ("vsock/test: add send_buf() utility function")
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Luigi Leonardi <leonardi@redhat.com>
Link: https://patch.msgid.link/20260403093251.30662-1-sgarzare@redhat.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/vsock/util.c