numam-dpdk/drivers/net/virtio
Alexander Chernavin 52bd03e969 net/virtio: fix crash when configured twice
When first attempt to configure a device with RX interrupt enabled fails
for some reason (e.g. because "Multiple intr vector not supported"),
second attempt to configure the device with RX interrupt disabled and
feature set unchanged will succeed but will leave virtio queues not
allocated. Accessing the queues will cause a segfault.

First attempt:
  - virtio_dev_configure()
    - virtio_init_device() is called to reinit the device because
      "dev->data->dev_conf.intr_conf.rxq" is "1"
      - virtio_configure_intr() fails and returns an error
      - virtio_free_queues() frees previously allocated virtio queues
    - virtio_init_device() fails and returns an error
  - virtio_dev_configure() fails and returns an error

Second attempt:
  - virtio_dev_configure()
    - This time virtio_init_device() is not called, virtio queues
      are not allocated

With this fix, reinit the device during configuration if virtio queues
are not allocated.

Fixes: 2b38151f74 ("net/virtio: fix queue memory leak on error")
Cc: stable@dpdk.org

Signed-off-by: Alexander Chernavin <achernavin@netgate.com>
Reviewed-by: Chenbo Xia <chenbo.xia@intel.com>
2022-09-29 10:13:22 +02:00
..
virtio_user eal: remove unneeded includes from a public header 2022-09-21 15:31:03 +02:00
meson.build net/virtio: restore some optimisations with AVX512 2022-05-09 21:15:38 +02:00
version.map version: 22.11-rc0 2022-07-21 12:13:48 +02:00
virtio_ethdev.c net/virtio: fix crash when configured twice 2022-09-29 10:13:22 +02:00
virtio_ethdev.h net/virtio: support RSS 2021-10-29 11:23:10 +02:00
virtio_logs.h net/virtio: implement dynamic logging 2018-01-16 18:47:49 +01:00
virtio_pci_ethdev.c dev: hide driver object 2022-09-23 16:14:34 +02:00
virtio_pci.c bus: hide bus object 2022-09-23 16:14:34 +02:00
virtio_pci.h bus/pci: make driver-only headers private 2022-09-23 16:14:34 +02:00
virtio_ring.h replace zero-length arrays with flexible ones 2022-06-07 16:44:21 +02:00
virtio_rxtx_packed_avx.h fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
virtio_rxtx_packed_neon.h net/virtio: revert forcing IOVA as VA mode for virtio-user 2021-09-30 12:58:09 +02:00
virtio_rxtx_packed.c net/virtio: fix oversized packets in vectorized Rx 2021-10-21 14:24:21 +02:00
virtio_rxtx_packed.h net/virtio: fix slots number when indirect feature on 2022-02-08 12:13:22 +01:00
virtio_rxtx_simple_altivec.c avoid AltiVec keyword vector 2022-05-25 11:49:39 +02:00
virtio_rxtx_simple_neon.c net/virtio: fix vectorized Rx queue rearm 2021-05-04 10:08:11 +02:00
virtio_rxtx_simple_sse.c net/virtio: fix vectorized Rx queue rearm 2021-05-04 10:08:11 +02:00
virtio_rxtx_simple.c ethdev: make driver-only headers private 2021-01-29 20:59:09 +01:00
virtio_rxtx_simple.h net/virtio: revert forcing IOVA as VA mode for virtio-user 2021-09-30 12:58:09 +02:00
virtio_rxtx.c net/virtio: fix Tx queue 0 overriden by queue 128 2022-01-27 05:54:26 +01:00
virtio_rxtx.h net/virtio: allocate fake mbuf in Rx queue 2021-03-31 07:31:41 +02:00
virtio_user_ethdev.c bus/vdev: make driver-only headers private 2022-09-23 16:14:34 +02:00
virtio.c net/virtio: wait device ready during reset 2021-09-28 17:26:50 +02:00
virtio.h net/virtio: fix link update in speed feature 2021-10-29 12:32:30 +02:00
virtqueue.c fix spelling in comments and strings 2022-01-11 12:16:53 +01:00
virtqueue.h replace zero-length arrays with flexible ones 2022-06-07 16:44:21 +02:00