public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: David Daney <david.daney@cavium.com>
Cc: linux-kernel@vger.kernel.org,
	Jesse Barnes <jbarnes@virtuousgeek.org>,
	linux-pci@vger.kernel.org,
	Grant Likely <grant.likely@secretlab.ca>
Subject: Re: [PATCH] pci/of: Don't crash when bridge parent is NULL.
Date: Tue, 16 Aug 2011 14:16:18 -0500	[thread overview]
Message-ID: <1313522178.3664.69.camel@pasglop> (raw)
In-Reply-To: <1313519077-18457-1-git-send-email-david.daney@cavium.com>

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@cavium.com>

Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

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

Cheers,
Ben.

> Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
> Cc: linux-pci@vger.kernel.org
> Cc: Grant Likely <grant.likely@secretlab.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;
>  }



  reply	other threads:[~2011-08-16 19:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-16 18:24 [PATCH] pci/of: Don't crash when bridge parent is NULL David Daney
2011-08-16 19:16 ` Benjamin Herrenschmidt [this message]
2011-08-17  4:11   ` Jesse Barnes
2011-08-17 11:29     ` Grant Likely

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1313522178.3664.69.camel@pasglop \
    --to=benh@kernel.crashing.org \
    --cc=david.daney@cavium.com \
    --cc=grant.likely@secretlab.ca \
    --cc=jbarnes@virtuousgeek.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox