[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1313522178.3664.69.camel@pasglop>
Date: Tue, 16 Aug 2011 14:16:18 -0500
From: Benjamin Herrenschmidt <benh@...nel.crashing.org>
To: David Daney <david.daney@...ium.com>
Cc: linux-kernel@...r.kernel.org,
Jesse Barnes <jbarnes@...tuousgeek.org>,
linux-pci@...r.kernel.org, Grant Likely <grant.likely@...retlab.ca>
Subject: Re: [PATCH] pci/of: Don't crash when bridge parent is NULL.
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@...ium.com>
Acked-by: Benjamin Herrenschmidt <benh@...nel.crashing.org>
Jesse or Grant, I'm travelling, can any of you send that to Linus asap ?
Cheers,
Ben.
> Cc: Jesse Barnes <jbarnes@...tuousgeek.org>
> Cc: linux-pci@...r.kernel.org
> Cc: Grant Likely <grant.likely@...retlab.ca>
> ---
> 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-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