Skip to content

Commit

Permalink
VSOCK: fix loopback on big-endian systems
Browse files Browse the repository at this point in the history
The dst_cid and src_cid are 64 bits, therefore 64 bit accessors should be
used, and in fact in virtio_transport_common.c only 64 bit accessors are
used. Using 32 bit accessors for 64 bit values breaks big endian systems.

This patch fixes a wrong use of le32_to_cpu in virtio_transport_send_pkt.

Fixes: b911682 ("VSOCK: add loopback to virtio_transport")

Signed-off-by: Claudio Imbrenda <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Claudio Imbrenda authored and davem330 committed Jun 22, 2018
1 parent 40141bb commit e5ab564
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/vmw_vsock/virtio_transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ virtio_transport_send_pkt(struct virtio_vsock_pkt *pkt)
return -ENODEV;
}

if (le32_to_cpu(pkt->hdr.dst_cid) == vsock->guest_cid)
if (le64_to_cpu(pkt->hdr.dst_cid) == vsock->guest_cid)
return virtio_transport_send_pkt_loopback(vsock, pkt);

if (pkt->reply)
Expand Down

0 comments on commit e5ab564

Please sign in to comment.