From: Alex Williamson <alex.williamson@redhat.com>
To: Eric Auger <eric.auger@redhat.com>
Cc: eric.auger.pro@gmail.com, linux-kernel@vger.kernel.org,
stable@vger.kernel.org, cohuck@redhat.com,
xyjxie@linux.vnet.ibm.com
Subject: Re: [PATCH] vfio/pci: Move dummy_resources_list init in vfio_pci_probe()
Date: Thu, 3 Dec 2020 16:49:43 -0700 [thread overview]
Message-ID: <20201203164943.3b78c35d@w520.home> (raw)
In-Reply-To: <20201113175202.4500-1-eric.auger@redhat.com>
On Fri, 13 Nov 2020 18:52:02 +0100
Eric Auger <eric.auger@redhat.com> wrote:
> 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+
> ---
> drivers/vfio/pci/vfio_pci.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
Thanks, Eric. Applied to vfio next branch for v5.11.
Alex
>
> diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c
> index e6190173482c..47ebc5c49ca4 100644
> --- a/drivers/vfio/pci/vfio_pci.c
> +++ b/drivers/vfio/pci/vfio_pci.c
> @@ -161,8 +161,6 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev)
> int i;
> struct vfio_pci_dummy_resource *dummy_res;
>
> - INIT_LIST_HEAD(&vdev->dummy_resources_list);
> -
> for (i = 0; i < PCI_STD_NUM_BARS; i++) {
> int bar = i + PCI_STD_RESOURCES;
>
> @@ -1966,6 +1964,7 @@ static int vfio_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
> mutex_init(&vdev->igate);
> spin_lock_init(&vdev->irqlock);
> mutex_init(&vdev->ioeventfds_lock);
> + INIT_LIST_HEAD(&vdev->dummy_resources_list);
> INIT_LIST_HEAD(&vdev->ioeventfds_list);
> mutex_init(&vdev->vma_lock);
> INIT_LIST_HEAD(&vdev->vma_list);
prev parent reply other threads:[~2020-12-03 23:51 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-13 17:52 [PATCH] vfio/pci: Move dummy_resources_list init in vfio_pci_probe() Eric Auger
2020-12-03 23:49 ` Alex Williamson [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201203164943.3b78c35d@w520.home \
--to=alex.williamson@redhat.com \
--cc=cohuck@redhat.com \
--cc=eric.auger.pro@gmail.com \
--cc=eric.auger@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=xyjxie@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).