From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755417AbbFRMJQ (ORCPT ); Thu, 18 Jun 2015 08:09:16 -0400 Received: from terminus.zytor.com ([198.137.202.10]:59727 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755318AbbFRMJA (ORCPT ); Thu, 18 Jun 2015 08:09:00 -0400 Date: Thu, 18 Jun 2015 05:07:42 -0700 From: tip-bot for Russell King Message-ID: Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jason@lakedaemon.net, rmk+kernel@arm.linux.org.uk, ulli.kroll@googlemail.com, hpa@zytor.com, thierry.reding@gmail.com, gnurou@gmail.com, lee.jones@linaro.org, tglx@linutronix.de, linus.walleij@linaro.org Reply-To: linus.walleij@linaro.org, tglx@linutronix.de, lee.jones@linaro.org, gnurou@gmail.com, thierry.reding@gmail.com, hpa@zytor.com, ulli.kroll@googlemail.com, jason@lakedaemon.net, rmk+kernel@arm.linux.org.uk, mingo@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: References: To: linux-tip-commits@vger.kernel.org Subject: [tip:irq/core] gpio: gpio-mxc: Fix race in installing chained IRQ handler Git-Commit-ID: e65eea54e98566de2cbb10e710873bc5e34c6680 X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: e65eea54e98566de2cbb10e710873bc5e34c6680 Gitweb: http://git.kernel.org/tip/e65eea54e98566de2cbb10e710873bc5e34c6680 Author: Russell King AuthorDate: Tue, 16 Jun 2015 23:06:40 +0100 Committer: Thomas Gleixner CommitDate: Thu, 18 Jun 2015 14:03:08 +0200 gpio: gpio-mxc: Fix race in installing chained IRQ handler Fix a race where a pending interrupt could be received and the handler called before the handler's data has been setup, by converting to irq_set_chained_handler_and_data(). Signed-off-by: Russell King Cc: Alexandre Courbot Cc: Hans Ulli Kroll Cc: Jason Cooper Cc: Lee Jones Cc: Linus Walleij Cc: Thierry Reding Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/E1Z4z0C-0002SX-Lj@rmk-PC.arm.linux.org.uk Signed-off-by: Thomas Gleixner --- drivers/gpio/gpio-mxc.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/gpio/gpio-mxc.c b/drivers/gpio/gpio-mxc.c index 9f7446a..e4f42c9 100644 --- a/drivers/gpio/gpio-mxc.c +++ b/drivers/gpio/gpio-mxc.c @@ -437,14 +437,13 @@ static int mxc_gpio_probe(struct platform_device *pdev) irq_set_chained_handler(port->irq, mx2_gpio_irq_handler); } else { /* setup one handler for each entry */ - irq_set_chained_handler(port->irq, mx3_gpio_irq_handler); - irq_set_handler_data(port->irq, port); - if (port->irq_high > 0) { + irq_set_chained_handler_and_data(port->irq, + mx3_gpio_irq_handler, port); + if (port->irq_high > 0) /* setup handler for GPIO 16 to 31 */ - irq_set_chained_handler(port->irq_high, - mx3_gpio_irq_handler); - irq_set_handler_data(port->irq_high, port); - } + irq_set_chained_handler_and_data(port->irq_high, + mx3_gpio_irq_handler, + port); } err = bgpio_init(&port->bgc, &pdev->dev, 4,