Index: head/sys/dev/hyperv/vmbus/hv_ring_buffer.c =================================================================== --- head/sys/dev/hyperv/vmbus/hv_ring_buffer.c +++ head/sys/dev/hyperv/vmbus/hv_ring_buffer.c @@ -339,8 +339,12 @@ mtx_lock_spin(&rbr->rxbr_lock); + /* + * The requested data and the 64bits channel packet + * offset should be there at least. + */ bytesAvailToRead = vmbus_rxbr_avail(rbr); - if (bytesAvailToRead < dlen) { + if (bytesAvailToRead < dlen + sizeof(uint64_t)) { mtx_unlock_spin(&rbr->rxbr_lock); return (EAGAIN); } @@ -366,7 +370,7 @@ mtx_lock_spin(&rbr->rxbr_lock); bytes_avail_to_read = vmbus_rxbr_avail(rbr); - if (bytes_avail_to_read < dlen) { + if (bytes_avail_to_read < dlen + offset + sizeof(prev_indices)) { mtx_unlock_spin(&rbr->rxbr_lock); return (EAGAIN); }