lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:   Sat, 2 Jan 2021 17:29:02 +1300
From:   Barry Song <song.bao.hua@...ilicon.com>
To:     <dmitry.torokhov@...il.com>, <linux-input@...r.kernel.org>
CC:     <linux-kernel@...r.kernel.org>,
        Barry Song <song.bao.hua@...ilicon.com>
Subject: [PATCH] Input: ar1021 - use IRQ_NOAUTOEN flags to replace disable_irq

disable_irq() after request_irq is unsafe as it gives a time gap which
irq can come before disable_irq(). IRQ_NOAUTOEN is the common way to
avoid enabling IRQ due to requesting IRQ.

Signed-off-by: Barry Song <song.bao.hua@...ilicon.com>
---
 drivers/input/touchscreen/ar1021_i2c.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/input/touchscreen/ar1021_i2c.c b/drivers/input/touchscreen/ar1021_i2c.c
index c0d5c2413356..c9e98ed4520e 100644
--- a/drivers/input/touchscreen/ar1021_i2c.c
+++ b/drivers/input/touchscreen/ar1021_i2c.c
@@ -123,6 +123,11 @@ static int ar1021_i2c_probe(struct i2c_client *client,
 
 	input_set_drvdata(input, ar1021);
 
+	/*
+	 * Don't enable the IRQ automatically, we'll enable it in
+	 * ar1021_i2c_open()
+	 */
+	irq_set_status_flags(client->irq, IRQ_NOAUTOEN);
 	error = devm_request_threaded_irq(&client->dev, client->irq,
 					  NULL, ar1021_i2c_irq,
 					  IRQF_ONESHOT,
@@ -133,9 +138,6 @@ static int ar1021_i2c_probe(struct i2c_client *client,
 		return error;
 	}
 
-	/* Disable the IRQ, we'll enable it in ar1021_i2c_open() */
-	disable_irq(client->irq);
-
 	error = input_register_device(ar1021->input);
 	if (error) {
 		dev_err(&client->dev,
-- 
2.25.1

Powered by blists - more mailing lists