From patchwork Tue Aug 30 04:17:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "majun (F)" X-Patchwork-Id: 9304809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8B09460756 for ; Tue, 30 Aug 2016 04:20:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7448728AB3 for ; Tue, 30 Aug 2016 04:20:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6463128ABC; Tue, 30 Aug 2016 04:20:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4D91128AB3 for ; Tue, 30 Aug 2016 04:20:39 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1beaVg-0000c6-8E; Tue, 30 Aug 2016 04:18:52 +0000 Received: from szxga01-in.huawei.com ([58.251.152.64]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1beaVa-0000Zg-SR for linux-arm-kernel@lists.infradead.org; Tue, 30 Aug 2016 04:18:48 +0000 Received: from 172.24.1.60 (EHLO szxeml431-hub.china.huawei.com) ([172.24.1.60]) by szxrg01-dlp.huawei.com (MOS 4.3.7-GA FastPath queued) with ESMTP id DQI00922; Tue, 30 Aug 2016 12:17:40 +0800 (CST) Received: from localhost (10.177.235.245) by szxeml431-hub.china.huawei.com (10.82.67.208) with Microsoft SMTP Server id 14.3.235.1; Tue, 30 Aug 2016 12:17:28 +0800 From: MaJun To: , , , , , , Subject: [PATCH] generic: Add the exception case checking routine for ppi interrupt Date: Tue, 30 Aug 2016 12:17:19 +0800 Message-ID: <1472530639-21616-1-git-send-email-majun258@huawei.com> X-Mailer: git-send-email 1.9.5.msysgit.1 MIME-Version: 1.0 X-Originating-IP: [10.177.235.245] X-CFilter-Loop: Reflected X-Mirapoint-Virus-RAPID-Raw: score=unknown(0), refid=str=0001.0A090203.57C508E9.0022, ss=1, re=0.000, recu=0.000, reip=0.000, cl=1, cld=1, fgs=0, ip=0.0.0.0, so=2013-06-18 04:22:30, dmn=2013-03-21 17:37:32 X-Mirapoint-Loop-Id: 827da74567518681909c627243e8c831 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160829_211847_392244_1FD0EA7B X-CRM114-Status: GOOD ( 11.28 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP From: Ma Jun During system booting, if the interrupt which has no action registered is triggered, it would cause system panic when try to access the action member. Signed-off-by: Ma Jun --- kernel/irq/chip.c | 20 ++++++++++++++++---- 1 files changed, 16 insertions(+), 4 deletions(-) diff --git a/kernel/irq/chip.c b/kernel/irq/chip.c index 8114d06..9a0e872 100644 --- a/kernel/irq/chip.c +++ b/kernel/irq/chip.c @@ -766,11 +766,23 @@ handle_percpu_irq(unsigned int irq, struct irq_desc *desc) */ void handle_percpu_devid_irq(unsigned int irq, struct irq_desc *desc) { - struct irq_chip *chip = irq_desc_get_chip(desc); - struct irqaction *action = desc->action; - void *dev_id = raw_cpu_ptr(action->percpu_dev_id); + struct irq_chip *chip = NULL; + struct irqaction *action; + void *dev_id; irqreturn_t res; + action = desc->action; + + /* Unexpected interrupt in some execption case + * we just send eoi to end this interrupt + */ + if (unlikely(!action)) { + mask_irq(desc); + goto out; + } + dev_id = raw_cpu_ptr(action->percpu_dev_id); + + chip = irq_desc_get_chip(desc); kstat_incr_irqs_this_cpu(irq, desc); if (chip->irq_ack) @@ -779,7 +791,7 @@ void handle_percpu_devid_irq(unsigned int irq, struct irq_desc *desc) trace_irq_handler_entry(irq, action); res = action->handler(irq, dev_id); trace_irq_handler_exit(irq, action, res); - +out: if (chip->irq_eoi) chip->irq_eoi(&desc->irq_data); }