Re: [PATCH net v2] hv_sock: Report EOF instead of -EIO for FIN

From: Stefano Garzarella

Date: Fri Apr 17 2026 - 04:15:33 EST


On Thu, Apr 16, 2026 at 12:14:33PM -0700, Dexuan Cui wrote:
Commit f0c5827d07cb unluckily causes a regression for the FIN packet,
and the final read syscall gets an error rather than 0.

Ideally, we would want to fix hvs_channel_readable_payload() so that it
could return 0 in the FIN scenario, but it's not good for the hv_sock
driver to use the VMBus ringbuffer's cached priv_read_index, which is
internal data in the VMBus driver.

Fix the regression in hv_sock by returning 0 rather than -EIO.

Fixes: f0c5827d07cb ("hv_sock: Return the readable bytes in hvs_stream_has_data()")
Cc: stable@xxxxxxxxxxxxxxx
Reported-by: Ben Hillis <Ben.Hillis@xxxxxxxxxxxxx>
Reported-by: Mitchell Levy <levymitchell0@xxxxxxxxx>
Signed-off-by: Dexuan Cui <decui@xxxxxxxxxxxxx>
---

Changes since v1:
Removed the local variable 'need_refill' to make the code more
readable. Stefano, thanks!

Thanks for the fix!


No other change.

net/vmw_vsock/hyperv_transport.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)

Acked-by: Stefano Garzarella <sgarzare@xxxxxxxxxx>