net/virtio: fix secondary process crash with PCI devices
authorMaxime Coquelin <maxime.coquelin@redhat.com>
Wed, 3 Feb 2021 15:58:11 +0000 (16:58 +0100)
committerFerruh Yigit <ferruh.yigit@intel.com>
Thu, 4 Feb 2021 17:19:36 +0000 (18:19 +0100)
commitaa0d4b8a0186060d452d37f715236b4b31fd3752
treefba026cef83fbb18a3f0215bedd8537a0dbbec52
parentfa545ed3da44ae1ef083a7eb9be2d1c2f6ddc7eb
net/virtio: fix secondary process crash with PCI devices

The Virtio rework series mistakenly moved the rte_pci_device
pointer to struct virtio_hw, which is shared between the two
processes. But this structure is per-process, so this change
made secondary process to try accessing primary process-only
memory, leading to a crash.

This patch reverts to proper behavior, by storing the
rte_pci_device pointer into the per-process
virtio_pci_internal struct. It also provides helper to get
the pointer from the virtio_hw struct pointer.

Bugzilla ID: 633
Fixes: c8d4b02f72ae ("net/virtio: move legacy IO to virtio PCI")

Reported-by: Anatoly Burakov <anatoly.burakov@intel.com>
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
drivers/net/virtio/virtio_pci.c
drivers/net/virtio/virtio_pci.h
drivers/net/virtio/virtio_pci_ethdev.c