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

Configure Feed

Select the types of activity you want to include in your feed.

hv_sock: Return -EIO for malformed/short packets

Commit f63152958994 fixes a regression, however it fails to report an
error for malformed/short packets -- normally we should never see such
packets, but let's report an error for them just in case.

Fixes: f63152958994 ("hv_sock: Report EOF instead of -EIO for FIN")
Cc: stable@vger.kernel.org
Signed-off-by: Dexuan Cui <decui@microsoft.com>
Acked-by: Stefano Garzarella <sgarzare@redhat.com>
Link: https://patch.msgid.link/20260423064811.1371749-1-decui@microsoft.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Dexuan Cui and committed by
Jakub Kicinski
3d1f2072 3bc06da8

+18 -9
+18 -9
net/vmw_vsock/hyperv_transport.c
··· 704 704 if (hvs->recv_desc) { 705 705 /* Here hvs->recv_data_len is 0, so hvs->recv_desc must 706 706 * be NULL unless it points to the 0-byte-payload FIN 707 - * packet: see hvs_update_recv_data(). 707 + * packet or a malformed/short packet: see 708 + * hvs_update_recv_data(). 708 709 * 709 - * Here all the payload has been dequeued, but 710 - * hvs_channel_readable_payload() still returns 1, 711 - * because the VMBus ringbuffer's read_index is not 712 - * updated for the FIN packet: hvs_stream_dequeue() -> 713 - * hv_pkt_iter_next() updates the cached priv_read_index 714 - * but has no opportunity to update the read_index in 715 - * hv_pkt_iter_close() as hvs_stream_has_data() returns 716 - * 0 for the FIN packet, so it won't get dequeued. 710 + * If hvs->recv_desc points to the FIN packet, here all 711 + * the payload has been dequeued and the peer_shutdown 712 + * flag is set, but hvs_channel_readable_payload() still 713 + * returns 1, because the VMBus ringbuffer's read_index 714 + * is not updated for the FIN packet: 715 + * hvs_stream_dequeue() -> hv_pkt_iter_next() updates 716 + * the cached priv_read_index but has no opportunity to 717 + * update the read_index in hv_pkt_iter_close() as 718 + * hvs_stream_has_data() returns 0 for the FIN packet, 719 + * so it won't get dequeued. 720 + * 721 + * In case hvs->recv_desc points to a malformed/short 722 + * packet, return -EIO. 717 723 */ 724 + if (!(vsk->peer_shutdown & SEND_SHUTDOWN)) 725 + return -EIO; 726 + 718 727 return 0; 719 728 } 720 729