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] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64N.0612011656410.26933@attu4.cs.washington.edu>
Date:	Fri, 1 Dec 2006 16:59:55 -0800 (PST)
From:	David Rientjes <rientjes@...washington.edu>
To:	Jesper Juhl <jesper.juhl@...il.com>
cc:	linux-kernel@...r.kernel.org, Martin Mares <mj@....cz>
Subject: Re: [PATCH] Be a bit defensive in quirk_nvidia_ck804() so we don't
 risk dereferencing a NULL pdev.

On Sat, 2 Dec 2006, Jesper Juhl wrote:

> pci_get_slot() may return NULL if nothing was found. 
> quirk_nvidia_ck804() does not check the value returned from pci_get_slot(),
> so it may end up causing a NULL pointer deref.
> 

Looks good.  The possible NULL pointer is actually not at pci_dev_put, 
but rather at pci_find_capability on the msi_ht_cap_enabled(pdev) call.

> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index 5b44838..d3dcbda 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -1741,6 +1741,8 @@ static void __devinit quirk_nvidia_ck804
>  	 * a single one having MSI is enough to be sure that MSI are supported.
>  	 */
>  	pdev = pci_get_slot(dev->bus, 0);
> +	if (!pdev)
> +		return;
>  	if (dev->subordinate && !msi_ht_cap_enabled(dev)
>  	    && !msi_ht_cap_enabled(pdev)) {
>  		printk(KERN_WARNING "PCI: MSI quirk detected. "
> 

The check for dev->subordinate in the neighboring conditional can also be 
removed.

		David
-
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