[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20100716121248.0f3daa3b@virtuousgeek.org>
Date: Fri, 16 Jul 2010 12:12:48 -0700
From: Jesse Barnes <jbarnes@...tuousgeek.org>
To: Jacob Pan <jacob.jun.pan@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>,
Ben Greear <greearb@...delatech.com>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86/pci/mrst: add extra check in fixed bar detection
On Fri, 16 Jul 2010 11:58:26 -0700
Jacob Pan <jacob.jun.pan@...ux.intel.com> wrote:
> Fixed bar capability structure is searched in PCI extended configuration
> space. We need to make sure there is a valid capability id to begin with
> otherwise, the search code may stuck in a infinite loop which results in
> boot hang.
> This patch adds additional check for cap ID 0, which is also invalid.
>
> Suggested-by: "H. Peter Anvin" <hpa@...or.com>
>
> Signed-off-by: Jacob Pan <jacob.jun.pan@...ux.intel.com>
> ---
> arch/x86/pci/mrst.c | 7 ++++---
> 1 files changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/pci/mrst.c b/arch/x86/pci/mrst.c
> index c9649d0..8636567 100644
> --- a/arch/x86/pci/mrst.c
> +++ b/arch/x86/pci/mrst.c
> @@ -66,8 +66,9 @@ static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn)
> devfn, pos, 4, &pcie_cap))
> return 0;
>
> - if (pcie_cap == 0xffffffff)
> - return 0;
> + if (PCI_EXT_CAP_ID(pcie_cap) == 0x0000 ||
> + PCI_EXT_CAP_ID(pcie_cap) == 0xffff)
> + break;
>
> if (PCI_EXT_CAP_ID(pcie_cap) == PCI_EXT_CAP_ID_VNDR) {
> raw_pci_ext_ops->read(pci_domain_nr(bus), bus->number,
> @@ -76,7 +77,7 @@ static int fixed_bar_cap(struct pci_bus *bus, unsigned int devfn)
> return pos;
> }
>
> - pos = pcie_cap >> 20;
> + pos = PCI_EXT_CAP_NEXT(pcie_cap);
> }
>
> return 0;
Looks good.
Reviewed-by: Jesse Barnes <jbarnes@...tuousgeek.org>
--
Jesse Barnes, Intel Open Source Technology Center
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists