Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

virtio-net: Remove more stack DMA

VLAN and MQ control was doing DMA from the stack. Fix it.

Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>
Signed-off-by: Andy Lutomirski <luto@kernel.org>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andy Lutomirski and committed by
David S. Miller
a725ee3e cbce91ca

+8 -5
+8 -5
drivers/net/virtio_net.c
··· 144 144 /* Control VQ buffers: protected by the rtnl lock */ 145 145 struct virtio_net_ctrl_hdr ctrl_hdr; 146 146 virtio_net_ctrl_ack ctrl_status; 147 + struct virtio_net_ctrl_mq ctrl_mq; 147 148 u8 ctrl_promisc; 148 149 u8 ctrl_allmulti; 150 + u16 ctrl_vid; 149 151 150 152 /* Ethtool settings */ 151 153 u8 duplex; ··· 1060 1058 static int virtnet_set_queues(struct virtnet_info *vi, u16 queue_pairs) 1061 1059 { 1062 1060 struct scatterlist sg; 1063 - struct virtio_net_ctrl_mq s; 1064 1061 struct net_device *dev = vi->dev; 1065 1062 1066 1063 if (!vi->has_cvq || !virtio_has_feature(vi->vdev, VIRTIO_NET_F_MQ)) 1067 1064 return 0; 1068 1065 1069 - s.virtqueue_pairs = cpu_to_virtio16(vi->vdev, queue_pairs); 1070 - sg_init_one(&sg, &s, sizeof(s)); 1066 + vi->ctrl_mq.virtqueue_pairs = cpu_to_virtio16(vi->vdev, queue_pairs); 1067 + sg_init_one(&sg, &vi->ctrl_mq, sizeof(vi->ctrl_mq)); 1071 1068 1072 1069 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MQ, 1073 1070 VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET, &sg)) { ··· 1173 1172 struct virtnet_info *vi = netdev_priv(dev); 1174 1173 struct scatterlist sg; 1175 1174 1176 - sg_init_one(&sg, &vid, sizeof(vid)); 1175 + vi->ctrl_vid = vid; 1176 + sg_init_one(&sg, &vi->ctrl_vid, sizeof(vi->ctrl_vid)); 1177 1177 1178 1178 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 1179 1179 VIRTIO_NET_CTRL_VLAN_ADD, &sg)) ··· 1188 1186 struct virtnet_info *vi = netdev_priv(dev); 1189 1187 struct scatterlist sg; 1190 1188 1191 - sg_init_one(&sg, &vid, sizeof(vid)); 1189 + vi->ctrl_vid = vid; 1190 + sg_init_one(&sg, &vi->ctrl_vid, sizeof(vi->ctrl_vid)); 1192 1191 1193 1192 if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_VLAN, 1194 1193 VIRTIO_NET_CTRL_VLAN_DEL, &sg))