]>
Commit | Line | Data |
---|---|---|
ea254054 GKH |
1 | From foo@baz Thu Apr 26 20:47:12 CEST 2018 |
2 | From: "Michael S. Tsirkin" <mst@redhat.com> | |
3 | Date: Thu, 19 Apr 2018 08:30:49 +0300 | |
4 | Subject: virtio_net: fix adding vids on big-endian | |
5 | ||
6 | From: "Michael S. Tsirkin" <mst@redhat.com> | |
7 | ||
8 | ||
9 | [ Upstream commit d7fad4c840f33a6bd333dd7fbb3006edbcf0017a ] | |
10 | ||
11 | Programming vids (adding or removing them) still passes | |
12 | guest-endian values in the DMA buffer. That's wrong | |
13 | if guest is big-endian and when virtio 1 is enabled. | |
14 | ||
15 | Note: this is on top of a previous patch: | |
16 | virtio_net: split out ctrl buffer | |
17 | ||
18 | Fixes: 9465a7a6f ("virtio_net: enable v1.0 support") | |
19 | Signed-off-by: Michael S. Tsirkin <mst@redhat.com> | |
20 | Acked-by: Jason Wang <jasowang@redhat.com> | |
21 | Signed-off-by: David S. Miller <davem@davemloft.net> | |
22 | Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> | |
23 | --- | |
24 | drivers/net/virtio_net.c | 6 +++--- | |
25 | 1 file changed, 3 insertions(+), 3 deletions(-) | |
26 | ||
27 | --- a/drivers/net/virtio_net.c | |
28 | +++ b/drivers/net/virtio_net.c | |
29 | @@ -123,7 +123,7 @@ struct control_buf { | |
30 | struct virtio_net_ctrl_mq mq; | |
31 | u8 promisc; | |
32 | u8 allmulti; | |
33 | - u16 vid; | |
34 | + __virtio16 vid; | |
35 | u64 offloads; | |
36 | }; | |
37 | ||
38 | @@ -1602,7 +1602,7 @@ static int virtnet_vlan_rx_add_vid(struc | |
39 | struct virtnet_info *vi = netdev_priv(dev); | |
40 | struct scatterlist sg; | |
41 | ||
42 | - vi->ctrl->vid = vid; | |
43 | + vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); | |
44 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); | |
45 | ||
46 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, | |
47 | @@ -1617,7 +1617,7 @@ static int virtnet_vlan_rx_kill_vid(stru | |
48 | struct virtnet_info *vi = netdev_priv(dev); | |
49 | struct scatterlist sg; | |
50 | ||
51 | - vi->ctrl->vid = vid; | |
52 | + vi->ctrl->vid = cpu_to_virtio16(vi->vdev, vid); | |
53 | sg_init_one(&sg, &vi->ctrl->vid, sizeof(vi->ctrl->vid)); | |
54 | ||
55 | if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, |