vfio/pci: Move dummy_resources_list init in vfio_pci_probe()
commit17171362314cb65c81cc35c0c42396acaf126317
authorEric Auger <eric.auger@redhat.com>
Fri, 13 Nov 2020 17:52:02 +0000 (13 18:52 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Jan 2021 12:35:48 +0000 (9 13:35 +0100)
treea22a49be2339b5e3af378ea9c96326c7df069ad2
parentd6cc7407b251892b176773448f8ec74fdc8c4b71
vfio/pci: Move dummy_resources_list init in vfio_pci_probe()

[ Upstream commit 16b8fe4caf499ae8e12d2ab1b1324497e36a7b83 ]

In case an error occurs in vfio_pci_enable() before the call to
vfio_pci_probe_mmaps(), vfio_pci_disable() will  try to iterate
on an uninitialized list and cause a kernel panic.

Lets move to the initialization to vfio_pci_probe() to fix the
issue.

Signed-off-by: Eric Auger <eric.auger@redhat.com>
Fixes: 05f0c03fbac1 ("vfio-pci: Allow to mmap sub-page MMIO BARs if the mmio page is exclusive")
CC: Stable <stable@vger.kernel.org> # v4.7+
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/vfio/pci/vfio_pci.c