qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alex Williamson <alex.williamson@redhat.com>
To: Vasilis Liaskovitis <vliaskovitis@suse.com>
Cc: qemu-devel@nongnu.org, clg@redhat.com
Subject: Re: [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk
Date: Tue, 11 Mar 2025 08:31:52 -0600	[thread overview]
Message-ID: <20250311083152.6e26d8b2.alex.williamson@redhat.com> (raw)
In-Reply-To: <20250310235833.41026-1-vliaskovitis@suse.com>

On Tue, 11 Mar 2025 00:58:33 +0100
Vasilis Liaskovitis <vliaskovitis@suse.com> wrote:

> The ATI BAR4 quirk is targeting an ioport BAR. Older devices may
> have a BAR4 which is not an ioport, causing a segfault here. Test
> the BAR type to skip these devices.
> 
> Similar to
> "8f419c5b: vfio/pci-quirks: Exclude non-ioport BAR from NVIDIA quirk"
> 
> Untested, as I don't have the card to test.
> 
> Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2856
> Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com>
> ---
>  hw/vfio/pci-quirks.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/vfio/pci-quirks.c b/hw/vfio/pci-quirks.c
> index c53591fe2b..15598bbaf4 100644
> --- a/hw/vfio/pci-quirks.c
> +++ b/hw/vfio/pci-quirks.c
> @@ -403,7 +403,7 @@ static void vfio_probe_ati_bar4_quirk(VFIOPCIDevice *vdev, int nr)
>  
>      /* This windows doesn't seem to be used except by legacy VGA code */
>      if (!vfio_pci_is(vdev, PCI_VENDOR_ID_ATI, PCI_ANY_ID) ||
> -        !vdev->vga || nr != 4) {
> +        !vdev->vga || nr != 4 || !vdev->bars[4].ioport) {
>          return;
>      }
>  

We should probably predicate calls to vfio_bar_quirk_setup() on
VFIOBAR.size to avoid such segfaults, but agree this likely fixes the
reported issue as well.

Reviewed-by: Alex Williamson <alex.williamson@redhat.com>



  reply	other threads:[~2025-03-11 14:33 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-10 23:58 [RFC PATCH] vfio/pci-quirks: Exclude non-ioport BAR from ATI quirk Vasilis Liaskovitis
2025-03-11 14:31 ` Alex Williamson [this message]
2025-03-11 15:45 ` Cédric Le Goater

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=20250311083152.6e26d8b2.alex.williamson@redhat.com \
    --to=alex.williamson@redhat.com \
    --cc=clg@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=vliaskovitis@suse.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).