Skip to content

Commit 99975cc

Browse files
committed
vhost/net: length miscalculation
commit 8b38694 vhost/net: virtio 1.0 byte swap had this chunk: - heads[headcount - 1].len += datalen; + heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen); This adds datalen with the wrong sign, causing guest panics. Fixes: 8b38694 Reported-by: Alex Williamson <[email protected]> Suggested-by: Greg Kurz <[email protected]> Signed-off-by: Michael S. Tsirkin <[email protected]>
1 parent a1eb03f commit 99975cc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/vhost/net.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ static int get_rx_bufs(struct vhost_virtqueue *vq,
538538
++headcount;
539539
seg += in;
540540
}
541-
heads[headcount - 1].len = cpu_to_vhost32(vq, len - datalen);
541+
heads[headcount - 1].len = cpu_to_vhost32(vq, len + datalen);
542542
*iovcount = seg;
543543
if (unlikely(log))
544544
*log_num = nlogs;

0 commit comments

Comments
 (0)