stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Anson Huang <anson.huang@nxp.com>,
	Anson Huang <Anson.Huang@nxp.com>,
	Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Sasha Levin <sashal@kernel.org>,
	linux-input@vger.kernel.org
Subject: [PATCH AUTOSEL 4.4 06/14] Input: snvs_pwrkey - initialize necessary driver data before enabling IRQ
Date: Tue,  7 May 2019 01:42:08 -0400	[thread overview]
Message-ID: <20190507054218.340-6-sashal@kernel.org> (raw)
In-Reply-To: <20190507054218.340-1-sashal@kernel.org>

From: Anson Huang <anson.huang@nxp.com>

[ Upstream commit bf2a7ca39fd3ab47ef71c621a7ee69d1813b1f97 ]

SNVS IRQ is requested before necessary driver data initialized,
if there is a pending IRQ during driver probe phase, kernel
NULL pointer panic will occur in IRQ handler. To avoid such
scenario, just initialize necessary driver data before enabling
IRQ. This patch is inspired by NXP's internal kernel tree.

Fixes: d3dc6e232215 ("input: keyboard: imx: add snvs power key driver")
Signed-off-by: Anson Huang <Anson.Huang@nxp.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 drivers/input/keyboard/snvs_pwrkey.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/snvs_pwrkey.c b/drivers/input/keyboard/snvs_pwrkey.c
index 9adf13a5864a..57143365e945 100644
--- a/drivers/input/keyboard/snvs_pwrkey.c
+++ b/drivers/input/keyboard/snvs_pwrkey.c
@@ -156,6 +156,9 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 		return error;
 	}
 
+	pdata->input = input;
+	platform_set_drvdata(pdev, pdata);
+
 	error = devm_request_irq(&pdev->dev, pdata->irq,
 			       imx_snvs_pwrkey_interrupt,
 			       0, pdev->name, pdev);
@@ -172,9 +175,6 @@ static int imx_snvs_pwrkey_probe(struct platform_device *pdev)
 		return error;
 	}
 
-	pdata->input = input;
-	platform_set_drvdata(pdev, pdata);
-
 	device_init_wakeup(&pdev->dev, pdata->wakeup);
 
 	return 0;
-- 
2.20.1


  parent reply	other threads:[~2019-05-07  5:44 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-07  5:42 [PATCH AUTOSEL 4.4 01/14] iio: adc: xilinx: fix potential use-after-free on remove Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 02/14] HID: input: add mapping for Expose/Overview key Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 03/14] HID: input: add mapping for keyboard Brightness Up/Down/Toggle keys Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 04/14] libnvdimm/btt: Fix a kmemdup failure check Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 05/14] s390/dasd: Fix capacity calculation for large volumes Sasha Levin
2019-05-07  5:42 ` Sasha Levin [this message]
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 07/14] s390/3270: fix lockdep false positive on view->lock Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 08/14] KVM: x86: avoid misreporting level-triggered irqs as edge-triggered in tracing Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 09/14] tools lib traceevent: Fix missing equality check for strcmp Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 10/14] init: initialize jump labels before command line option parsing Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 11/14] ipvs: do not schedule icmp errors from tunnels Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 12/14] s390: ctcm: fix ctcm_new_device error return code Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 13/14] selftests/net: correct the return value for run_netsocktests Sasha Levin
2019-05-07  5:42 ` [PATCH AUTOSEL 4.4 14/14] gpu: ipu-v3: dp: fix CSC handling Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190507054218.340-6-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=anson.huang@nxp.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).