virtio-net: count VIRTIO_NET_F_MAC when calculating config_len
authorJason Wang <jasowang@redhat.com>
Thu, 25 Apr 2013 07:26:54 +0000 (15:26 +0800)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 30 Apr 2013 21:04:24 +0000 (16:04 -0500)
commite9016ee2bda1b7757072b856b2196f691aee3388
tree4a13d4b01fb54acf30ce557dc8cd731c780a96d1
parent9f032464c06c563fe0df49eac9caaaa90a68a219
virtio-net: count VIRTIO_NET_F_MAC when calculating config_len

Commit 14f9b664 (hw/virtio-net.c: set config size using host features) tries to
calculate config size based on the host features. But it forgets the
VIRTIO_NET_F_MAC were always set for qemu later. This will lead a zero config
len for virtio-net device when both VIRTIO_NET_F_STATUS and VIRTIO_NET_F_MQ were
disabled form command line. Then qemu will crash when user tries to read the
config of virtio-net.

Fix this by counting VIRTIO_NET_F_MAC and make sure the config at least contains
the mac address.

Cc: Jesse Larrew <jlarrew@linux.vnet.ibm.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Message-id: 1366874814-2658-1-git-send-email-jasowang@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/net/virtio-net.c