From patchwork Mon Sep 28 06:31:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xiaotian Feng X-Patchwork-Id: 50365 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8S6YVn7004482 for ; Mon, 28 Sep 2009 06:34:31 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751151AbZI1GeO (ORCPT ); Mon, 28 Sep 2009 02:34:14 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751136AbZI1GeO (ORCPT ); Mon, 28 Sep 2009 02:34:14 -0400 Received: from mx1.redhat.com ([209.132.183.28]:31144 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751151AbZI1GeN (ORCPT ); Mon, 28 Sep 2009 02:34:13 -0400 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n8S6VLTr002826; Mon, 28 Sep 2009 02:31:21 -0400 Received: from localhost.localdomain (dhcp-65-132.nay.redhat.com [10.66.65.132]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id n8S6VHe3016624; Mon, 28 Sep 2009 02:31:18 -0400 From: Xiaotian Feng To: lenb@kernel.org, bjorn.helgaas@hp.com, achiang@hp.com, andrew.patterson@hp.com, jbarnes@virtuousgeek.org Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org, Xiaotian Feng Subject: [PATCH] acpi: pci_root: fix NULL pointer deref after resume from suspend Date: Mon, 28 Sep 2009 14:31:20 +0800 Message-Id: <1254119480-9730-1-git-send-email-dfeng@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 Sender: linux-acpi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org commit 275582 introduces acpi_get_pci_dev(), but pdev->subordinate can be NULL, then a NULL was passed to pci_get_slot, this results the kernel oops when resume from suspend. This patch resolves following kernel oops: BUG: unable to handle kernel NULL pointer dereference at 0000000000000028 IP: [] pci_get_slot+0x4c/0x8c Signed-off-by: Xiaotian Feng --- drivers/acpi/pci_root.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c index 3112221..3c35144 100644 --- a/drivers/acpi/pci_root.c +++ b/drivers/acpi/pci_root.c @@ -387,7 +387,11 @@ struct pci_dev *acpi_get_pci_dev(acpi_handle handle) if (!pdev || hnd == handle) break; - pbus = pdev->subordinate; + if (pdev->subordinate) + pbus = pdev->subordinate; + else + pbus = pdev->bus; + pci_dev_put(pdev); } out: