From patchwork Fri Nov 21 01:02:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Suthikulpanit, Suravee" X-Patchwork-Id: 41266 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id E152C23C27 for ; Fri, 21 Nov 2014 01:02:51 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id c13sf2699550eek.10 for ; Thu, 20 Nov 2014 17:02:51 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:cc:subject:date:message-id :mime-version:content-type:sender:precedence:list-id :x-original-sender:x-original-authentication-results:mailing-list :list-post:list-help:list-archive:list-unsubscribe; bh=YwRvmJLP+sJ0uAwYbz6RwhHKwx0AQ7SEan7PSX6UaLs=; b=WbhO92FODR0yT1qJoD5lQ3kErOkG0Mp9dBshfjqUf6zyuTT9ofHK9hQZvOT2vw/3Fk 5Ey9Ow70r3EwtlUBM5IHaM6RiwKgYB4kdeQnZLspuidpty2m/OqTbueZ0FDra1fEs9Ps WY4IneEwgpIJSzIRaOCF407UqNt8pF/3R2FGLcIaEO18En7qSo5nr7TrcLv2ZY9BtfV4 5c6hCHKCQbPJD6M8VScxdvSPtS6Iid50D8KZpx9gbeeGOTk4Gzk6q9ogE4bccNlr8iWb W0ZYxpwgCjdGv1C4Ojs0yeHQof/xEMTN66lkMiPowoGLZ/USx+kE+0EiAMOBBtG0N+16 Z2Yw== X-Gm-Message-State: ALoCoQlzn1tCVREO8IvqPG1xQ2kmDNNbutRRxhWU8xZB9e5dP0iDMqBpAPGc+IJxZak90MP4Y2SP X-Received: by 10.112.199.167 with SMTP id jl7mr469260lbc.5.1416531771057; Thu, 20 Nov 2014 17:02:51 -0800 (PST) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.3 with SMTP id 3ls87409lai.89.gmail; Thu, 20 Nov 2014 17:02:50 -0800 (PST) X-Received: by 10.152.179.67 with SMTP id de3mr1121743lac.73.1416531770679; Thu, 20 Nov 2014 17:02:50 -0800 (PST) Received: from mail-la0-f43.google.com (mail-la0-f43.google.com. [209.85.215.43]) by mx.google.com with ESMTPS id av10si3468693lbc.99.2014.11.20.17.02.50 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 20 Nov 2014 17:02:50 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) client-ip=209.85.215.43; Received: by mail-la0-f43.google.com with SMTP id q1so3465830lam.30 for ; Thu, 20 Nov 2014 17:02:50 -0800 (PST) X-Received: by 10.153.7.170 with SMTP id dd10mr1261080lad.44.1416531770521; Thu, 20 Nov 2014 17:02:50 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp366218lbc; Thu, 20 Nov 2014 17:02:49 -0800 (PST) X-Received: by 10.70.55.102 with SMTP id r6mr1920821pdp.55.1416531768495; Thu, 20 Nov 2014 17:02:48 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id eg2si5536935pbb.89.2014.11.20.17.02.47 for ; Thu, 20 Nov 2014 17:02:48 -0800 (PST) Received-SPF: none (google.com: linux-kernel-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757104AbaKUBCp (ORCPT + 26 others); Thu, 20 Nov 2014 20:02:45 -0500 Received: from mail-bl2on0145.outbound.protection.outlook.com ([65.55.169.145]:15434 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756487AbaKUBCn (ORCPT ); Thu, 20 Nov 2014 20:02:43 -0500 Received: from BN1PR02CA0051.namprd02.prod.outlook.com (10.141.56.51) by BY2PR02MB201.namprd02.prod.outlook.com (10.242.232.12) with Microsoft SMTP Server (TLS) id 15.1.16.15; Fri, 21 Nov 2014 01:02:40 +0000 Received: from BN1AFFO11FD029.protection.gbl (2a01:111:f400:7c10::158) by BN1PR02CA0051.outlook.office365.com (2a01:111:e400:2a::51) with Microsoft SMTP Server (TLS) id 15.1.16.15 via Frontend Transport; Fri, 21 Nov 2014 01:02:40 +0000 Received: from atltwp01.amd.com (165.204.84.221) by BN1AFFO11FD029.mail.protection.outlook.com (10.58.52.184) with Microsoft SMTP Server id 15.1.6.13 via Frontend Transport; Fri, 21 Nov 2014 01:02:39 +0000 X-WSS-ID: 0NFD6WD-07-QQW-02 X-M-MSG: Received: from satlvexedge02.amd.com (satlvexedge02.amd.com [10.177.96.29]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by atltwp01.amd.com (Axway MailGate 5.3.1) with ESMTPS id 2BDE4CAE64F; Thu, 20 Nov 2014 19:02:37 -0600 (CST) Received: from SATLEXDAG04.amd.com (10.181.40.9) by SATLVEXEDGE02.amd.com (10.177.96.29) with Microsoft SMTP Server (TLS) id 14.3.195.1; Thu, 20 Nov 2014 19:03:03 -0600 Received: from ssuthiku-fedora-lt.amd.com (10.180.168.240) by satlexdag04.amd.com (10.181.40.9) with Microsoft SMTP Server id 14.3.195.1; Thu, 20 Nov 2014 20:02:36 -0500 From: To: , CC: , , , , "Suravee Suthikulpanit" Subject: [PATCH] irqdomain: Fix NULL pointer dererence in irq_domain_free_irqs_parent Date: Thu, 20 Nov 2014 19:02:25 -0600 Message-ID: <1416531745-24661-1-git-send-email-suravee.suthikulpanit@amd.com> X-Mailer: git-send-email 1.9.3 MIME-Version: 1.0 X-EOPAttributedMessage: 0 Received-SPF: None (protection.outlook.com: amd.com does not designate permitted sender hosts) X-Forefront-Antispam-Report: CIP:165.204.84.221; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10019020)(6009001)(428002)(199003)(189002)(46102003)(95666004)(106466001)(120916001)(33646002)(97736003)(62966003)(77096003)(53416004)(64706001)(105586002)(77156002)(93916002)(107046002)(4396001)(20776003)(86362001)(50226001)(87286001)(92726001)(229853001)(47776003)(36756003)(99396003)(21056001)(84676001)(50986999)(88136002)(89996001)(68736004)(50466002)(86152002)(92566001)(101416001)(19580405001)(102836001)(104166001)(44976005)(19580395003)(48376002)(87936001)(31966008); DIR:OUT; SFP:1102; SCL:1; SRVR:BY2PR02MB201; H:atltwp01.amd.com; FPR:; MLV:sfv; PTR:InfoDomainNonexistent; A:1; MX:1; LANG:en; X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB201; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB201; X-Forefront-PRVS: 0402872DA1 X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:BY2PR02MB201; X-OriginatorOrg: amd4.onmicrosoft.com Sender: linux-kernel-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: suravee.suthikulpanit@amd.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.43 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , From: Suravee Suthikulpanit This patch checks if the parent domain is NULL before recursively freeing irqs in the parent domains. In this case, GICv2m is freeing irqs in parent (GIC), which calls irq_domain_free_irqs_top. This fixes the crash below: Unble to handle kernel NULL pointer dereference at virtual address 00000018 pgd = fffffe03c78c0000 [00000018] *pgd=00000083c8700003, *pud=00000083c8700003, *pmd=00000083c8700003, *pte=0000000000000000 Internal error: Oops: 96000007 [#1] SMP Modules linked in: mlx4_core(-) rtc_efi efivarfs [last unloaded: mlx4_en] CPU: 5 PID: 985 Comm: modprobe Not tainted 3.18.0-rc4-marc-v2m+ #223 task: fffffe03c20c0000 ti: fffffe03c1fb8000 task.ti: fffffe03c1fb8000 PC is at irq_domain_free_irqs_recursive+0x10/0x84 LR is at irq_domain_free_irqs_common+0x8c/0xa0 pc : [] lr : [] pstate: 60000145 sp : fffffe03c1fbb9a0 x29: fffffe03c1fbb9a0 x28: fffffe03c1fb8000 x27: fffffe000092f000 x26: fffffe03c10eba00 ... Call trace: [] irq_domain_free_irqs_recursive+0x10/0x84 [] irq_domain_free_irqs_common+0x88/0xa0 [] irq_domain_free_irqs_top+0x6c/0x84 [] irq_domain_free_irqs_recursive+0x24/0x84 [] irq_domain_free_irqs_parent+0x14/0x20 [] gicv2m_irq_domain_free+0x48/0x88 [] irq_domain_free_irqs_recursive+0x24/0x84 [] irq_domain_free_irqs_common+0x88/0xa0 [] irq_domain_free_irqs_top+0x6c/0x84 [] msi_domain_free+0x74/0x8c [] irq_domain_free_irqs_recursive+0x24/0x84 [] irq_domain_free_irqs+0x110/0x184 [] msi_domain_free_irqs+0x28/0x4c [] free_msi_irqs+0x90/0x1d8 [] pci_disable_msix+0x40/0x50 Signed-off-by: Suravee Suthikulpanit --- kernel/irq/irqdomain.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/kernel/irq/irqdomain.c b/kernel/irq/irqdomain.c index 029acf1..4390eb8 100644 --- a/kernel/irq/irqdomain.c +++ b/kernel/irq/irqdomain.c @@ -1166,6 +1166,9 @@ int irq_domain_alloc_irqs_parent(struct irq_domain *domain, void irq_domain_free_irqs_parent(struct irq_domain *domain, unsigned int irq_base, unsigned int nr_irqs) { + if (!domain->parent) + return; + /* irq_domain_free_irqs_recursive() will call parent's free */ if (!irq_domain_is_auto_recursive(domain)) irq_domain_free_irqs_recursive(domain->parent, irq_base,