Re: [PATCH] pci/of: Don't crash when bridge parent is NULL.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2011-08-16 at 11:24 -0700, David Daney wrote:
> In pcibios_get_phb_of_node(), we will crash while booting if
> bus->bridge->parent is NULL.
> 
> Check for this case and avoid dereferencing the NULL pointer.
> 
> Signed-off-by: David Daney <david.daney@xxxxxxxxxx>

Acked-by: Benjamin Herrenschmidt <benh@xxxxxxxxxxxxxxxxxxx>

Jesse or Grant, I'm travelling, can any of you send that to Linus asap ?

Cheers,
Ben.

> Cc: Jesse Barnes <jbarnes@xxxxxxxxxxxxxxxx>
> Cc: linux-pci@xxxxxxxxxxxxxxx
> Cc: Grant Likely <grant.likely@xxxxxxxxxxxx>
> ---
>  drivers/pci/of.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/pci/of.c b/drivers/pci/of.c
> index c94d37e..f092993 100644
> --- a/drivers/pci/of.c
> +++ b/drivers/pci/of.c
> @@ -55,7 +55,7 @@ struct device_node * __weak pcibios_get_phb_of_node(struct pci_bus *bus)
>  	 */
>  	if (bus->bridge->of_node)
>  		return of_node_get(bus->bridge->of_node);
> -	if (bus->bridge->parent->of_node)
> +	if (bus->bridge->parent && bus->bridge->parent->of_node)
>  		return of_node_get(bus->bridge->parent->of_node);
>  	return NULL;
>  }


--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [DMA Engine]     [Linux Coverity]     [Linux USB]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Greybus]

  Powered by Linux