From patchwork Tue Jan 3 08:09:49 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?SmFuIFLDvHRo?= X-Patchwork-Id: 710415 X-Patchwork-Delegate: bhelgaas@google.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 3tt6773WGwz9snk for ; Tue, 3 Jan 2017 19:09:54 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933590AbdACIJw (ORCPT ); Tue, 3 Jan 2017 03:09:52 -0500 Received: from mx-out-2.rwth-aachen.de ([134.130.5.187]:34356 "EHLO mx-out-2.rwth-aachen.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933567AbdACIJv (ORCPT ); Tue, 3 Jan 2017 03:09:51 -0500 X-Greylist: delayed 313 seconds by postgrey-1.27 at vger.kernel.org; Tue, 03 Jan 2017 03:09:51 EST X-IronPort-AV: E=Sophos;i="5.33,451,1477954800"; d="scan'208";a="477834949" Received: from lists.comsys.rwth-aachen.de ([137.226.13.21]) by mx-2.rz.rwth-aachen.de with ESMTP; 03 Jan 2017 09:09:50 +0100 Received: from messenger-mbx.win.comsys.rwth-aachen.de (messenger-mbx.win.comsys.rwth-aachen.de [137.226.13.43]) by lists.comsys.rwth-aachen.de (Postfix) with ESMTPS id 210EE3FF2E for ; Tue, 3 Jan 2017 09:09:50 +0100 (CET) Received: from stavro.comsys.rwth-aachen.de (137.226.12.26) by messenger-mbx.win.comsys.rwth-aachen.de (2002:89e2:d2b::89e2:d2b) with Microsoft SMTP Server (TLS) id 15.0.1076.9; Tue, 3 Jan 2017 09:09:49 +0100 To: From: =?UTF-8?B?SmFuIFLDvHRo?= Subject: [PATCH] pci/aspm: Fix null pointer dereference during re-enumeration of PCI bus in pcie_aspm_init_link_state even though ASPM is off Message-ID: <8dd91424-b38c-4875-9752-9cc42a6f5701@comsys.rwth-aachen.de> Date: Tue, 3 Jan 2017 09:09:49 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:45.0) Gecko/20100101 Thunderbird/45.6.0 MIME-Version: 1.0 X-Originating-IP: [137.226.12.26] X-ClientProxiedBy: MESSENGER.win.comsys.rwth-aachen.de (2002:89e2:d2a::89e2:d2a) To messenger-mbx.win.comsys.rwth-aachen.de (2002:89e2:d2b::89e2:d2b) Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org This patch fixes a null pointer dereference during PCI bus enumeration when ASPM is off. On an IBM x3850 8664 this bug causes the kernel to halt, this behavior did not appear in 3.10, so this is a regression. pcie_aspm_sanity_check should only be called if ASPM is on. Signed-off-by: Jan Rueth --- drivers/pci/pcie/aspm.c | +++-- 1 file changed, 3 insertions(+), 2 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c index f981129..e758b56 100644 --- a/drivers/pci/pcie/aspm.c +++ b/drivers/pci/pcie/aspm.c @@ -552,11 +552,12 @@ static struct pcie_link_state *alloc_pcie_link_state(struct pci_dev *pdev) void pcie_aspm_init_link_state(struct pci_dev *pdev) { struct pcie_link_state *link; - int blacklist = !!pcie_aspm_sanity_check(pdev); - + int blacklist; if (!aspm_support_enabled) return; + blacklist = !!pcie_aspm_sanity_check(pdev); + if (pdev->link_state) return;