From patchwork Tue Jun 16 22:06:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Russell King X-Patchwork-Id: 485208 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 4A79C1402AB for ; Wed, 17 Jun 2015 08:07:18 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=arm.linux.org.uk header.i=@arm.linux.org.uk header.b=q6vhBoXt; dkim-atps=neutral Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753390AbbFPWHR (ORCPT ); Tue, 16 Jun 2015 18:07:17 -0400 Received: from pandora.arm.linux.org.uk ([78.32.30.218]:35822 "EHLO pandora.arm.linux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752925AbbFPWHQ (ORCPT ); Tue, 16 Jun 2015 18:07:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=arm.linux.org.uk; s=pandora-2014; h=Date:Sender:Message-Id:Content-Type:Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From; bh=qiG3J+yc5g2Et1qOON7g2lUNgdcGwdPcgk2+8UtY//4=; b=q6vhBoXth6q+s+jZFI2FiZ/ZwlAkHCnDM2YGHdoX85XcQH6ydi0GVYq/Wa7bm8PAg1yg1UmI99bB02jukv1fZxSBt5tn/tcdBNZWf1BzGXSEy19szsNlmj1hJ9ctyLChjiYskxB5ohcyFBnZK426Rac4Jg0TLOJpilyz3O4nEbY=; Received: from e0022681537dd.dyn.arm.linux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:57649 helo=rmk-PC.arm.linux.org.uk) by pandora.arm.linux.org.uk with esmtpsa (TLSv1:AES128-SHA:128) (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Z4z0V-00041J-6V; Tue, 16 Jun 2015 23:06:59 +0100 Received: from rmk by rmk-PC.arm.linux.org.uk with local (Exim 4.82_1-5b7a7c0-XX) (envelope-from ) id 1Z4z0M-0002Sl-Ti; Tue, 16 Jun 2015 23:06:50 +0100 From: Russell King To: linux-arm-kernel@lists.infradead.org, linux-gpio@vger.kernel.org, linux-tegra@vger.kernel.org, Thomas Gleixner Cc: Alexandre Courbot , Hans Ulli Kroll , Jason Cooper , Lee Jones , Linus Walleij , Thierry Reding Subject: [PATCH 7/9] gpio: gpio-tegra: fix race in installing chained IRQ handler MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Tue, 16 Jun 2015 23:06:50 +0100 Sender: linux-gpio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-gpio@vger.kernel.org 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 --- Depends on patch 1. drivers/gpio/gpio-tegra.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpio/gpio-tegra.c b/drivers/gpio/gpio-tegra.c index 1741981d53c8..56dcc8ed98de 100644 --- a/drivers/gpio/gpio-tegra.c +++ b/drivers/gpio/gpio-tegra.c @@ -515,8 +515,8 @@ static int tegra_gpio_probe(struct platform_device *pdev) for (i = 0; i < tegra_gpio_bank_count; i++) { bank = &tegra_gpio_banks[i]; - irq_set_chained_handler(bank->irq, tegra_gpio_irq_handler); - irq_set_handler_data(bank->irq, bank); + irq_set_chained_handler_and_data(bank->irq, + tegra_gpio_irq_handler, bank); for (j = 0; j < 4; j++) spin_lock_init(&bank->lvl_lock[j]);