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-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 15 Sep 2008 22:02:39 +0200
From:	Uwe Kleine-König 
	<ukleinek@...ormatik.uni-freiburg.de>
To:	linux-kernel@...r.kernel.org
Cc:	David Brownell <david-b@...bell.net>,
	Guennadi Liakhovetski <g.liakhovetski@...gutronix.de>,
	Greg KH <greg@...ah.com>, Kay Sievers <kay.sievers@...y.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Russell King <rmk+kernel@....linux.org.uk>
Subject: [PATCH] gpio_free might sleep, generic part

According to the documentation gpio_free should only be called from task
context only.  To make this more explicit add a might sleep to all
implementations.

This is the generic part which changes gpiolib and the fallback
implementation only.

Signed-off-by: Uwe Kleine-König <ukleinek@...ormatik.uni-freiburg.de>
Cc: David Brownell <david-b@...bell.net>
Cc: Guennadi Liakhovetski <g.liakhovetski@...gutronix.de>
Cc: Greg KH <greg@...ah.com>
Cc: Kay Sievers <kay.sievers@...y.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Russell King <rmk+kernel@....linux.org.uk>
---
Hello,

this is a new version of the patch I sent on 2008-07-24 07:28:35 GMT
(http://thread.gmane.org/gmane.linux.kernel/711078)

David Brownell suggested (via private mail) to split the patch along
arch lines.  I did that, added Blackfin (which I missed last time) and
left out DaVinci (in ARCH=arm) on Dave's request.

Something that really made me happy is that git managed to use the old
patch although many includes for arm changed location with only three
conflicts.

Note the series is not compile tested because I only have an x86
compiler handy at the moment.

Best regards
Uwe

 drivers/gpio/gpiolib.c |    2 ++
 include/linux/gpio.h   |    3 +++
 2 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 8d29405..317004f 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -792,6 +792,8 @@ void gpio_free(unsigned gpio)
 	unsigned long		flags;
 	struct gpio_desc	*desc;
 
+	might_sleep();
+
 	if (!gpio_is_valid(gpio)) {
 		WARN_ON(extra_checks);
 		return;
diff --git a/include/linux/gpio.h b/include/linux/gpio.h
index 730a20b..e10c49a 100644
--- a/include/linux/gpio.h
+++ b/include/linux/gpio.h
@@ -8,6 +8,7 @@
 
 #else
 
+#include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/errno.h>
 
@@ -32,6 +33,8 @@ static inline int gpio_request(unsigned gpio, const char *label)
 
 static inline void gpio_free(unsigned gpio)
 {
+	might_sleep();
+
 	/* GPIO can never have been requested */
 	WARN_ON(1);
 }
-- 
1.5.6.5

--
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