From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753516AbbLaQbx (ORCPT ); Thu, 31 Dec 2015 11:31:53 -0500 Received: from www.linutronix.de ([62.245.132.108]:46658 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751262AbbLaQbo (ORCPT ); Thu, 31 Dec 2015 11:31:44 -0500 Message-Id: <20151231160106.236423282@linutronix.de> User-Agent: quilt/0.63-1 Date: Thu, 31 Dec 2015 16:30:45 -0000 From: Thomas Gleixner To: LKML Cc: Ingo Molnar , Peter Anvin , Jiang Liu , Joe Lawrence , Jeremiah Mahler , Borislav Petkov , andy.shevchenko@gmail.com, Guenter Roeck Subject: [patch 02/14] x86/irq: Validate that irq descriptor is still active References: <20151231155849.772553760@linutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Disposition: inline; filename=x86-irq--Validate-that-irq-descriptor-is-still-active.patch X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In fixup_irqs() we unconditionally dereference the irq chip of an irq descriptor. The descriptor might still be valid, but already cleaned up, i.e. the chip removed. Add a check for this condition. Signed-off-by: Thomas Gleixner --- arch/x86/kernel/irq.c | 9 +++++++++ 1 file changed, 9 insertions(+) --- a/arch/x86/kernel/irq.c +++ b/arch/x86/kernel/irq.c @@ -470,6 +470,15 @@ void fixup_irqs(void) } chip = irq_data_get_irq_chip(data); + /* + * The interrupt descriptor might have been cleaned up + * already, but it is not yet removed from the radix tree + */ + if (!chip) { + raw_spin_unlock(&desc->lock); + continue; + } + if (!irqd_can_move_in_process_context(data) && chip->irq_mask) chip->irq_mask(data);