Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751463AbdISUEY (ORCPT ); Tue, 19 Sep 2017 16:04:24 -0400 Received: from mail-wr0-f196.google.com ([209.85.128.196]:38782 "EHLO mail-wr0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751336AbdISUEW (ORCPT ); Tue, 19 Sep 2017 16:04:22 -0400 X-Google-Smtp-Source: AOwi7QDg5b/ds0oGPWuPbDwIz6Wu8jSwOo28lnEBDrEm4RT+Sr7bI3r5HVcUPDa9WqWXLuhe23cgew== Date: Tue, 19 Sep 2017 22:04:12 +0200 From: Alexandru Moise <00moses.alexander00@gmail.com> To: tglx@linutronix.de, linux-kernel@vger.kernel.org Subject: [PATCH] genirq: check __free_irq()'s return value for NULL Message-ID: <20170919200412.GA29985@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.9.0 (2017-09-02) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 643 Lines: 25 __free_irq() can return a NULL irqaction for example when trying to free already-free IRQ. Fix this by adding a check and return NULL. Signed-off-by: Alexandru Moise <00moses.alexander00@gmail.com> --- kernel/irq/manage.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 573dc52b0806..649bc34521da 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -1643,6 +1643,10 @@ const void *free_irq(unsigned int irq, void *dev_id) #endif action = __free_irq(irq, dev_id); + + if (!action) + return NULL; + devname = action->name; kfree(action); return devname; -- 2.14.1