virtio: fix crash in statistics functions
authorBernard Iremonger <bernard.iremonger@intel.com>
Wed, 23 Dec 2015 09:45:19 +0000 (09:45 +0000)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 17:52:18 +0000 (18:52 +0100)
commitc680a4a88c4312068f60937a7ba51eac8211c9a6
treee3ec5c7029297b78ed627fa74f87cb68e29da783
parent9a0615af7746485d73d10561cc0743bc2fcd4bf7
virtio: fix crash in statistics functions

This initialisation of nb_rx_queues and nb_tx_queues has been removed
from eth_virtio_dev_init.

The nb_rx_queues and nb_tx_queues were being initialised in
eth_virtio_dev_init before the tx_queues and rx_queues arrays were
allocated.

The arrays are allocated when the ethdev port is configured and the
nb_tx_queues and nb_rx_queues are initialised.

If any of the following functions were called before the ethdev
port was configured there was a segmentation fault because
rx_queues and tx_queues were NULL:

rte_eth_stats_get
rte_eth_stats_reset
rte_eth_xstats_get
rte_eth_xstats_reset

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

Signed-off-by: Bernard Iremonger <bernard.iremonger@intel.com>
Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Acked-by: Yuanhan Liu <yuanhan.liu@linux.intel.com>
drivers/net/virtio/virtio_ethdev.c