virtio: fix deadloop after wrong config read
authorChangchun Ouyang <changchun.ouyang@intel.com>
Thu, 22 Oct 2015 12:35:53 +0000 (20:35 +0800)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Mon, 26 Oct 2015 20:23:53 +0000 (21:23 +0100)
commit6d7740e2c1c9e92001afb8c5a205385e653e632c
tree900c69fbb288082eea21bded69eaa94e6789bd72
parent7c46842c9e534096816a77c97f02c10fbee87158
virtio: fix deadloop after wrong config read

The old code adjusts the config bytes we want to read depending on
what kind of features we have, but we later cast the entire buf we
read with "struct virtio_net_config", which is obviously wrong.

The wrong config reading results to a dead loop at virtio_send_command()
while starting testpmd.

The right way to go is to read related config bytes when corresponding
feature is set, which is exactly what this patch does.

Fixes: 823ad647950a ("virtio: support multiple queues")

Signed-off-by: Changchun Ouyang <changchun.ouyang@intel.com>
Signed-off-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Acked-by: Huawei Xie <huawei.xie@intel.com>
drivers/net/virtio/virtio_ethdev.c