virtio: fix crashes in virtio stats functions
PATCH 1/1 virtio: fix crashes in virtio stats 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_getrte_eth_stats_resetrte_eth_xstats_getrte_eth_xstats_reset
--- drivers/net/virtio/virtio_ethdev.c | 3 --- 1 file changed, 3 deletions(-)
drivers/net/virtio/virtio_ethdev.c +0 -3
@@ -1378,9 +1378,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) hw->max_tx_queues =1 ; } - eth_dev->data->nb_rx_queues = hw->max_rx_queues; - eth_dev->data->nb_tx_queues = hw->max_tx_queues; -PMD_INIT_LOG (DEBUG ,"hw->max_rx_queues=%d hw->max_tx_queues=%d" , hw->max_rx_queues, hw->max_tx_queues); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x",
Signature · 1 line
2.6.3
Quoted 37 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Bernard Iremonger
Sent: Wednesday, December 23, 2015 9:45 AM
To: [email protected]
Subject: [dpdk-dev] [PATCH] virtio: fix crashes in virtio stats functionsThis initialisation of
nb_rx_queuesandnb_tx_queueshas been removed frometh_virtio_dev_init.The
nb_rx_queuesandnb_tx_queueswere being initialised ineth_virtio_dev_initbefore thetx_queuesandrx_queuesarrays were allocated.The arrays are allocated when the ethdev port is configured and the
nb_tx_queuesandnb_rx_queuesare initialised.If any of the following functions were called before the ethdev port was configured there was a segmentation fault because
rx_queuesandtx_queueswere NULL:
rte_eth_stats_getrte_eth_stats_resetrte_eth_xstats_getrte_eth_xstats_resetFixes 823ad647950a ("virtio: support multiple queues")Signed-off-by Bernard Iremonger <[email protected]>--- drivers/net/virtio/virtio_ethdev.c | 3 --- 1 file changed, 3 deletions(-)drivers/net/virtio/virtio_ethdev.c +0
-0
drivers/net/virtio/virtio_ethdev.c eth_virtio_dev_init(struct rte_eth_dev *eth_dev)
Quoted 10 lines
drivers/net/virtio/virtio_ethdev.c +0
-4@@ -1378,9 +1378,6 @@ eth_virtio_dev_init(struct rte_eth_dev *eth_dev) hw->max_tx_queues =1 ; } - eth_dev->data->nb_rx_queues = hw->max_rx_queues; - eth_dev->data->nb_tx_queues = hw->max_tx_queues; -PMD_INIT_LOG (DEBUG ,"hw->max_rx_queues=%d hw->max_tx_queues=%d" , hw->max_rx_queues, hw->max_tx_queues); PMD_INIT_LOG(DEBUG, "port %d vendorID=0x%x deviceID=0x%x", --
Quoted 1 line
2.6.3
Quoted 13 lines · Bernard Iremonger
This initialisation of
nb_rx_queuesandnb_tx_queueshas been removed frometh_virtio_dev_init.The
nb_rx_queuesandnb_tx_queueswere being initialised ineth_virtio_dev_initbefore thetx_queuesandrx_queuesarrays were allocated.The arrays are allocated when the ethdev port is configured and the
nb_tx_queuesandnb_rx_queuesare initialised.If any of the following functions were called before the ethdev port was configured there was a segmentation fault because
rx_queuesandtx_queueswere NULL:
Quoted 7 lines
rte_eth_stats_getrte_eth_stats_resetrte_eth_xstats_getrte_eth_xstats_resetFixes 823ad647950a ("virtio: support multiple queues")Signed-off-by Bernard Iremonger <[email protected]>
Thanks.
--yliu
Bruce Richardson
AppliedQuoted 19 lines · Yuanhan Liu
Quoted 18 lines · Bernard Iremonger
This initialisation of
nb_rx_queuesandnb_tx_queueshas been removed frometh_virtio_dev_init.The
nb_rx_queuesandnb_tx_queueswere being initialised ineth_virtio_dev_initbefore thetx_queuesandrx_queuesarrays were allocated.The arrays are allocated when the ethdev port is configured and the
nb_tx_queuesandnb_rx_queuesare initialised.If any of the following functions were called before the ethdev port was configured there was a segmentation fault because
rx_queuesandtx_queueswere NULL:
rte_eth_stats_getrte_eth_stats_resetrte_eth_xstats_getrte_eth_xstats_reset
Quoted 8 lines
Quoted 2 lines
Fixes 823ad647950a ("virtio: support multiple queues")Signed-off-by Bernard Iremonger <[email protected]>Acked-by Yuanhan Liu <[email protected]>Thanks.
--yliu
Applied to dpdk-next-net/rel_16_04
/Bruce