lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 19 Jan 2015 13:48:57 -0500
From:	Alex Deucher <alexdeucher@...il.com>
To:	Michel Dänzer <michel@...nzer.net>
Cc:	Bjorn Helgaas <bhelgaas@...gle.com>,
	Linux PCI <linux-pci@...r.kernel.org>,
	LKML <linux-kernel@...r.kernel.org>,
	Maling list - DRI developers 
	<dri-devel@...ts.freedesktop.org>
Subject: Re: [PATCH v2] pci: Fix infinite loop with ROM image of size 0

On Mon, Jan 19, 2015 at 3:53 AM, Michel Dänzer <michel@...nzer.net> wrote:
> From: Michel Dänzer <michel.daenzer@....com>
>
> If the image size would ever read as 0, pci_get_rom_size could keep
> processing the same image over and over again.
>
> Reported-by: Federico <federicotg@...il.com>
> Cc: stable@...r.kernel.org
> Signed-off-by: Michel Dänzer <michel.daenzer@....com>

Reviewed-by: Alex Deucher <alexander.deucher@....com>

> ---
>
> v2:
> * Use unsigned instead of u16 for the local length variable (not sure if
>   the multiplication by 512 could overflow otherwise)
> * Integrate length condition into while statement
> * Add stable tag
>
>  drivers/pci/rom.c | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c
> index f955edb..eb0ad53 100644
> --- a/drivers/pci/rom.c
> +++ b/drivers/pci/rom.c
> @@ -71,6 +71,7 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
>  {
>         void __iomem *image;
>         int last_image;
> +       unsigned length;
>
>         image = rom;
>         do {
> @@ -93,9 +94,9 @@ size_t pci_get_rom_size(struct pci_dev *pdev, void __iomem *rom, size_t size)
>                 if (readb(pds + 3) != 'R')
>                         break;
>                 last_image = readb(pds + 21) & 0x80;
> -               /* this length is reliable */
> -               image += readw(pds + 16) * 512;
> -       } while (!last_image);
> +               length = readw(pds + 16);
> +               image += length * 512;
> +       } while (length && !last_image);
>
>         /* never return a size larger than the PCI resource window */
>         /* there are known ROMs that get the size wrong */
> --
> 2.1.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@...ts.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ