From patchwork Thu Mar 2 21:23:19 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Prado X-Patchwork-Id: 9601563 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 1CD69600CB for ; Thu, 2 Mar 2017 21:26:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CD83285F1 for ; Thu, 2 Mar 2017 21:26:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00536285F3; Thu, 2 Mar 2017 21:26:17 +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=-6.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6552E285F1 for ; Thu, 2 Mar 2017 21:26:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751541AbdCBVZe (ORCPT ); Thu, 2 Mar 2017 16:25:34 -0500 Received: from mail-qk0-f196.google.com ([209.85.220.196]:34374 "EHLO mail-qk0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750778AbdCBVZE (ORCPT ); Thu, 2 Mar 2017 16:25:04 -0500 Received: by mail-qk0-f196.google.com with SMTP id s186so22489981qkb.1 for ; Thu, 02 Mar 2017 13:23:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=e-labworks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=5U6UMit8dqKnqtQ/HXvlcN1Ktm9h93Y5n3zyvu5itX8=; b=oQ7vRrcrvRrRs/ZbPmxrXJNzovh3aliYlwrlEaL6pzSeN6KZw3/2IK5BYq7lQvVtxj eVi3ytfvNUzHlavo2kwor9N2X3x7m5IIBd9Dzzs+G313U0xBqVoOa8cc61+QJansMvfh lxIXduGQCVsR8PLx8YHmjTj4POyGLVV6Q7gEIW72moqQwFrt8rMJNOEKT6m1q5uGBDTg fsUb9F7htq+e/ix6EtEiOWNau3mZ1fCPH9I0cjM+hqfOwcPPpPflWDPIV5uqxgfeEeWK ELoEljlQFmlP73bLzALJ3RppbMO3ziIRtui6Fv2Ut2VEyFgM0COB7OLRG1SV5C3taKrZ aejA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=5U6UMit8dqKnqtQ/HXvlcN1Ktm9h93Y5n3zyvu5itX8=; b=rQ85L4Ah0LwLZw8M5qVrOdmb4a8bPYOJ/I97D88ZoMNSHZVeYRR0mtaoXPc7vTV+E6 YMzgQYFUOfadSahwpZktrcc7ApGIC7KIQuHG5y3vXy7bt/xEehREjM5LAfehhb5YUKFa /KKLHyw5BSbFpv0REbyajo9G8nNBygHAF51CkUX9LdPdpSAbum1NQbzzF8zmeU0963uC c3WWOOnINS4eouzybEMY9ogbTJ1OZVaYBTC6uj4TE7fwB6JaMhCU85nNIF756OTSNA+P RRfrVbarPwMJvANo6xmJ6vY0v/QjFhXf0BxBmUZb36sUCMtlb0MDAVUYa7RTHYEDdWg+ gOwQ== X-Gm-Message-State: AMke39mccqAFbqhnFZvyRiNVh9knB9/StFl8IEgdthTZ6/ZZyvdgy999GOMOT9rnmtxF2A== X-Received: by 10.200.51.252 with SMTP id d57mr19101596qtb.96.1488489824503; Thu, 02 Mar 2017 13:23:44 -0800 (PST) Received: from localhost.localdomain ([177.32.242.153]) by smtp.gmail.com with ESMTPSA id d22sm6218757qkj.4.2017.03.02.13.23.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Mar 2017 13:23:43 -0800 (PST) From: Sergio Prado To: kgene@kernel.org, krzk@kernel.org, javier@osg.samsung.com, tomasz.figa@gmail.com, s.nawrocki@samsung.com, linus.walleij@linaro.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Sergio Prado Subject: [PATCH] pinctrl: samsung: fix segfault when using external interrupts on s3c24xx Date: Thu, 2 Mar 2017 18:23:19 -0300 Message-Id: <1488489799-18136-1-git-send-email-sergio.prado@e-labworks.com> X-Mailer: git-send-email 1.9.1 Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We are getting a NULL pointer dereference when working with external interrupts on s3c24xx: Unable to handle kernel NULL pointer dereference at virtual address 000000a8 pgd = c0104000 [000000a8] *pgd=00000000 Internal error: Oops: 5 [#1] ARM Modules linked in: CPU: 0 PID: 0 Comm: swapper Not tainted 4.10.0-rc8mini2440-sub-00047-g0722f57bfae9-dirty #3 Hardware name: Samsung S3C2416 (Flattened Device Tree) task: c07399f8 task.stack: c0734000 PC is at s3c24xx_demux_eint4_7+0x24/0x10c LR is at s3c24xx_demux_eint4_7+0x108/0x10c The problem is in the function s3c24xx_demux_eint() when dereferencing bank->eint_base. At this point, we cannot get the bank pointer from the irq_desc structure since it is pointing to the hardware irq, not virq. So let's get the bank pointer directly from data->drvdata. This is a regression from commit 8b1bd11c1f8f529057369c5b3702d13fd24e2765. Tested on FriendlyARM mini2440. Signed-off-by: Sergio Prado --- drivers/pinctrl/samsung/pinctrl-s3c24xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c index b82a003546ae..1b8d887796e8 100644 --- a/drivers/pinctrl/samsung/pinctrl-s3c24xx.c +++ b/drivers/pinctrl/samsung/pinctrl-s3c24xx.c @@ -356,8 +356,8 @@ static inline void s3c24xx_demux_eint(struct irq_desc *desc, { struct s3c24xx_eint_data *data = irq_desc_get_handler_data(desc); struct irq_chip *chip = irq_desc_get_chip(desc); - struct irq_data *irqd = irq_desc_get_irq_data(desc); - struct samsung_pin_bank *bank = irq_data_get_irq_chip_data(irqd); + struct samsung_pinctrl_drv_data *d = data->drvdata; + struct samsung_pin_bank *bank = d->pin_banks; unsigned int pend, mask; chained_irq_enter(chip, desc);