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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 14 Oct 2007 09:25:23 +0200
From:	Nick Piggin <npiggin@...e.de>
To:	Linus Torvalds <torvalds@...ux-foundation.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Matthias Kaehlcke <matthias.kaehlcke@...il.com>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: [patch 1/2] hdaps: fix locking

Here are a couple of fixes for the hdaps driver. I have kind of been
blocking out the bug traces caused by these (the 2nd patch, actually)
thinking that it's one of those transient / churn things... but it's
getting annoying now because I think it turns off lockdep. After this
patch it no longer produces warnings, but I don't actually know if it
does the right thing (because I don't really know what the driver
does or how to test it anyway!).

---

hdaps was using incorrect mutex_trylock return code.

Signed-off-by: Nick Piggin <npiggin@...e.de>

---
Index: linux-2.6/drivers/hwmon/hdaps.c
===================================================================
--- linux-2.6.orig/drivers/hwmon/hdaps.c
+++ linux-2.6/drivers/hwmon/hdaps.c
@@ -328,22 +328,20 @@ static void hdaps_mousedev_poll(unsigned
 	int x, y;
 
 	/* Cannot sleep.  Try nonblockingly.  If we fail, try again later. */
-	if (mutex_trylock(&hdaps_mtx)) {
-		mod_timer(&hdaps_timer,jiffies + HDAPS_POLL_PERIOD);
-		return;
-	}
+	if (!mutex_trylock(&hdaps_mtx))
+		goto out;
 
 	if (__hdaps_read_pair(HDAPS_PORT_XPOS, HDAPS_PORT_YPOS, &x, &y))
-		goto out;
+		goto out_lock;
 
 	input_report_abs(hdaps_idev, ABS_X, x - rest_x);
 	input_report_abs(hdaps_idev, ABS_Y, y - rest_y);
 	input_sync(hdaps_idev);
 
-	mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
-
-out:
+out_lock:
 	mutex_unlock(&hdaps_mtx);
+out:
+	mod_timer(&hdaps_timer, jiffies + HDAPS_POLL_PERIOD);
 }
 
 
-
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