mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2025-01-18 10:07:39 +07:00
vsock/virtio: fix src/dst cid format
These fields are 64 bit, using le32_to_cpu and friends on these will not do the right thing. Fix this up. Cc: stable@vger.kernel.org Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
This commit is contained in:
parent
819483d806
commit
f83f12d660
@ -605,9 +605,9 @@ static int virtio_transport_reset_no_sock(struct virtio_vsock_pkt *pkt)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pkt = virtio_transport_alloc_pkt(&info, 0,
|
pkt = virtio_transport_alloc_pkt(&info, 0,
|
||||||
le32_to_cpu(pkt->hdr.dst_cid),
|
le64_to_cpu(pkt->hdr.dst_cid),
|
||||||
le32_to_cpu(pkt->hdr.dst_port),
|
le32_to_cpu(pkt->hdr.dst_port),
|
||||||
le32_to_cpu(pkt->hdr.src_cid),
|
le64_to_cpu(pkt->hdr.src_cid),
|
||||||
le32_to_cpu(pkt->hdr.src_port));
|
le32_to_cpu(pkt->hdr.src_port));
|
||||||
if (!pkt)
|
if (!pkt)
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
@ -822,7 +822,7 @@ virtio_transport_send_response(struct vsock_sock *vsk,
|
|||||||
struct virtio_vsock_pkt_info info = {
|
struct virtio_vsock_pkt_info info = {
|
||||||
.op = VIRTIO_VSOCK_OP_RESPONSE,
|
.op = VIRTIO_VSOCK_OP_RESPONSE,
|
||||||
.type = VIRTIO_VSOCK_TYPE_STREAM,
|
.type = VIRTIO_VSOCK_TYPE_STREAM,
|
||||||
.remote_cid = le32_to_cpu(pkt->hdr.src_cid),
|
.remote_cid = le64_to_cpu(pkt->hdr.src_cid),
|
||||||
.remote_port = le32_to_cpu(pkt->hdr.src_port),
|
.remote_port = le32_to_cpu(pkt->hdr.src_port),
|
||||||
.reply = true,
|
.reply = true,
|
||||||
};
|
};
|
||||||
@ -862,9 +862,9 @@ virtio_transport_recv_listen(struct sock *sk, struct virtio_vsock_pkt *pkt)
|
|||||||
child->sk_state = SS_CONNECTED;
|
child->sk_state = SS_CONNECTED;
|
||||||
|
|
||||||
vchild = vsock_sk(child);
|
vchild = vsock_sk(child);
|
||||||
vsock_addr_init(&vchild->local_addr, le32_to_cpu(pkt->hdr.dst_cid),
|
vsock_addr_init(&vchild->local_addr, le64_to_cpu(pkt->hdr.dst_cid),
|
||||||
le32_to_cpu(pkt->hdr.dst_port));
|
le32_to_cpu(pkt->hdr.dst_port));
|
||||||
vsock_addr_init(&vchild->remote_addr, le32_to_cpu(pkt->hdr.src_cid),
|
vsock_addr_init(&vchild->remote_addr, le64_to_cpu(pkt->hdr.src_cid),
|
||||||
le32_to_cpu(pkt->hdr.src_port));
|
le32_to_cpu(pkt->hdr.src_port));
|
||||||
|
|
||||||
vsock_insert_connected(vchild);
|
vsock_insert_connected(vchild);
|
||||||
@ -903,9 +903,9 @@ void virtio_transport_recv_pkt(struct virtio_vsock_pkt *pkt)
|
|||||||
struct sock *sk;
|
struct sock *sk;
|
||||||
bool space_available;
|
bool space_available;
|
||||||
|
|
||||||
vsock_addr_init(&src, le32_to_cpu(pkt->hdr.src_cid),
|
vsock_addr_init(&src, le64_to_cpu(pkt->hdr.src_cid),
|
||||||
le32_to_cpu(pkt->hdr.src_port));
|
le32_to_cpu(pkt->hdr.src_port));
|
||||||
vsock_addr_init(&dst, le32_to_cpu(pkt->hdr.dst_cid),
|
vsock_addr_init(&dst, le64_to_cpu(pkt->hdr.dst_cid),
|
||||||
le32_to_cpu(pkt->hdr.dst_port));
|
le32_to_cpu(pkt->hdr.dst_port));
|
||||||
|
|
||||||
trace_virtio_transport_recv_pkt(src.svm_cid, src.svm_port,
|
trace_virtio_transport_recv_pkt(src.svm_cid, src.svm_port,
|
||||||
|
Loading…
Reference in New Issue
Block a user