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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [day] [month] [year] [list]
Message-Id: <1225360010-20176-1-git-send-email-cooloney@kernel.org>
Date:	Thu, 30 Oct 2008 17:46:50 +0800
From:	Bryan Wu <cooloney@...nel.org>
To:	dtor@...l.ru, akpm@...ux-foundation.org
Cc:	linux-input@...r.kernel.org, linux-kernel@...r.kernel.org,
	Michael Hennerich <michael.hennerich@...log.com>,
	Bryan Wu <cooloney@...nel.org>
Subject: [PATCH 1/1] input: AD7877 driver fixup

From: Michael Hennerich <michael.hennerich@...log.com>

 - Test flag with spinlock hold

Signed-off-by: Michael Hennerich <michael.hennerich@...log.com>
Signed-off-by: Bryan Wu <cooloney@...nel.org>
---
 drivers/input/touchscreen/ad7877.c |   20 ++++++++++++--------
 1 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/input/touchscreen/ad7877.c b/drivers/input/touchscreen/ad7877.c
index aaf88c9..6615bcd 100644
--- a/drivers/input/touchscreen/ad7877.c
+++ b/drivers/input/touchscreen/ad7877.c
@@ -388,10 +388,11 @@ static irqreturn_t ad7877_irq(int irq, void *handle)
 	 * doesn't get issued twice while in work.
 	 */
 
-	if (ts->pending)
-		return IRQ_HANDLED;
-
 	spin_lock_irqsave(&ts->lock, flags);
+	if (ts->pending) {
+		spin_unlock_irqrestore(&ts->lock, flags);
+		return IRQ_HANDLED;
+	}
 	ts->pending = 1;
 	spin_unlock_irqrestore(&ts->lock, flags);
 
@@ -420,10 +421,12 @@ static void ad7877_disable(struct ad7877 *ts)
 {
 	unsigned long flags;
 
-	if (ts->disabled)
+	spin_lock_irqsave(&ts->lock, flags);
+	if (ts->disabled) {
+		spin_unlock_irqrestore(&ts->lock, flags);
 		return;
+	}
 
-	spin_lock_irqsave(&ts->lock, flags);
 	ts->disabled = 1;
 	disable_irq(ts->spi->irq);
 	spin_unlock_irqrestore(&ts->lock, flags);
@@ -443,10 +446,11 @@ static void ad7877_enable(struct ad7877 *ts)
 {
 	unsigned long flags;
 
-	if (!ts->disabled)
-		return;
-
 	spin_lock_irqsave(&ts->lock, flags);
+	if (ts->disabled) {
+		spin_unlock_irqrestore(&ts->lock, flags);
+		return;
+	}
 	ts->disabled = 0;
 	enable_irq(ts->spi->irq);
 	spin_unlock_irqrestore(&ts->lock, flags);
-- 
1.5.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ