From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Bjorn Helgaas <bhelgaas@google.com>, Yijing Wang <wangyijing@huawei.com>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
David Vrabel <david.vrabel@citrix.com>,
xen-devel@lists.xenproject.org, yinghai@kernel.org
Subject: Re: [Xen-devel] [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address
Date: Wed, 28 Jan 2015 16:05:18 -0500 [thread overview]
Message-ID: <54C94F0E.5020901@oracle.com> (raw)
In-Reply-To: <20150128181358.GA17623@google.com>
On 01/28/2015 01:13 PM, Bjorn Helgaas wrote:
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index fd60806..c3e7dfc 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -694,11 +694,16 @@ static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries)
> {
> resource_size_t phys_addr;
> u32 table_offset;
> + unsigned long flags;
> u8 bir;
>
> pci_read_config_dword(dev, dev->msix_cap + PCI_MSIX_TABLE,
> &table_offset);
> bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR);
> + flags = pci_resource_flags(dev, bir);
> + if (!flags || (flags & IORESOURCE_UNSET))
> + return NULL;
> Thanks, this looks better.
>
> There's similar code in xen_initdom_setup_msi_irqs() that looks like it
> might require a similar fix.
Right, I think it does.
One question: do we need to check flags for IORESOURCE_DISABLED as well?
Currently IORESOURCE_DISABLED and IORESOURCE_UNSET are set together for
PCI so it probably doesn't matter right now but if this changes we won't
want to use BAR that's disabled, will we?
-boris
WARNING: multiple messages have this Message-ID (diff)
From: Boris Ostrovsky <boris.ostrovsky@oracle.com>
To: Bjorn Helgaas <bhelgaas@google.com>, Yijing Wang <wangyijing@huawei.com>
Cc: kvm@vger.kernel.org, linux-pci@vger.kernel.org,
Alex Williamson <alex.williamson@redhat.com>,
David Vrabel <david.vrabel@citrix.com>,
xen-devel@lists.xenproject.org, yinghai@kernel.org
Subject: Re: [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address
Date: Wed, 28 Jan 2015 16:05:18 -0500 [thread overview]
Message-ID: <54C94F0E.5020901@oracle.com> (raw)
In-Reply-To: <20150128181358.GA17623@google.com>
On 01/28/2015 01:13 PM, Bjorn Helgaas wrote:
>
> diff --git a/drivers/pci/msi.c b/drivers/pci/msi.c
> index fd60806..c3e7dfc 100644
> --- a/drivers/pci/msi.c
> +++ b/drivers/pci/msi.c
> @@ -694,11 +694,16 @@ static void __iomem *msix_map_region(struct pci_dev *dev, unsigned nr_entries)
> {
> resource_size_t phys_addr;
> u32 table_offset;
> + unsigned long flags;
> u8 bir;
>
> pci_read_config_dword(dev, dev->msix_cap + PCI_MSIX_TABLE,
> &table_offset);
> bir = (u8)(table_offset & PCI_MSIX_TABLE_BIR);
> + flags = pci_resource_flags(dev, bir);
> + if (!flags || (flags & IORESOURCE_UNSET))
> + return NULL;
> Thanks, this looks better.
>
> There's similar code in xen_initdom_setup_msi_irqs() that looks like it
> might require a similar fix.
Right, I think it does.
One question: do we need to check flags for IORESOURCE_DISABLED as well?
Currently IORESOURCE_DISABLED and IORESOURCE_UNSET are set together for
PCI so it probably doesn't matter right now but if this changes we won't
want to use BAR that's disabled, will we?
-boris
next prev parent reply other threads:[~2015-01-29 1:27 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-28 1:52 [PATCH v2] PCI: Add guard to avoid mapping a invalid msix base address Yijing Wang
2015-01-28 18:13 ` Bjorn Helgaas
2015-01-28 18:13 ` Bjorn Helgaas
2015-01-28 21:05 ` Boris Ostrovsky [this message]
2015-01-28 21:05 ` Boris Ostrovsky
2015-01-28 22:05 ` [Xen-devel] " Bjorn Helgaas
2015-01-28 22:05 ` Bjorn Helgaas
2015-01-29 1:30 ` [Xen-devel] " Yijing Wang
2015-01-29 1:30 ` Yijing Wang
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=54C94F0E.5020901@oracle.com \
--to=boris.ostrovsky@oracle.com \
--cc=alex.williamson@redhat.com \
--cc=bhelgaas@google.com \
--cc=david.vrabel@citrix.com \
--cc=kvm@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=wangyijing@huawei.com \
--cc=xen-devel@lists.xenproject.org \
--cc=yinghai@kernel.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.