> After a partial stream receive, rx_bytes tracks the unread suffix while
> buf_used and peer credit still cover the whole packet.
> virtio_transport_read_skb() dequeues that packet but passes pkt_len for
> both counters, underflowing rx_bytes.
>
> On a connected CID_LOCAL stream with an SK_SKB verdict, a 40-byte read
> from a 100-byte packet made SIOCINQ report -40, an empty recv return
> ELOOP, and poll report the empty socket readable. After verdict detach,
> receiving 40 bytes wrapped the counter to zero and hid those queued bytes
> until one more byte arrived. The fixed run kept the counter balanced
> and exposed all queued data immediately.
>
> Subtract only skb->len minus the VSOCK offset from rx_bytes. Retain the
> full packet length for buf_used and peer credit.
>
> Fixes: 45ca7e9f0730 ("vsock/virtio: fix `rx_bytes` accounting for stream
> sockets")
> Cc: [email protected]
> Assisted-by: LLM
> Signed-off-by: Daehyeon Ko <[email protected]>
Sashiko has reviewed this patch and found no issues. It looks great!
--
Sashiko AI review ยท
https://sashiko.dev/#/patchset/[email protected]?part=1