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, 30 Jul 2012 16:57:33 +1000
From:	NeilBrown <neilb@...e.de>
To:	Linus Walleij <linus.walleij@...aro.org>
Cc:	linux-kernel@...r.kernel.org,
	Grant Likely <grant.likely@...retlab.ca>,
	Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: Re: [GIT PULL] GPIO changes for v3.6

On Thu, 26 Jul 2012 00:48:57 +0200 Linus Walleij <linus.walleij@...aro.org>
wrote:

> Hi Linus,
> 
> in Grants absence, these are my queued and -next-tested changes
> for v3.6, please pull them in. Grants "merge" branch prior to his
> absence was merged in as a base for this patch series.
> 
> The following is the same information as found in the tag:
> 
> GPIO changes for v3.6:
> - New driver for AMD-8111 southbridge GPIOs
> - New driver for Wolfson Micro Arizona devices
> - Propagate device tree parse errors
> - Probe deferral finalizations - all expected calls to
>   GPIO will now hopefully request deferral where apropriate
> - Misc updates to TCA6424, WM8994, LPC32xx, PCF857x, Samsung
>   MXC, OMAP and PCA953X drivers.
> 
..
> Mark Brown (5):
>       gpiolib: Defer failed gpio requests by default

Hi,
 this doesn't look quite right to me.

it means that if !gpio_is_valid(gpio), the error returned is EPROBE_DEFER 
which isn't right (an invalid gpio number will never become valid).
If a driver happened to use gpio_request to check the validity of the gpio
rather than doing it itself, it would defer the probe, rather than assume
that the GPIO doesn't exist.

I would suggest the following.  Reasonable?

NeilBrown

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index de0213c..259233b 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1186,13 +1186,14 @@ int gpio_request(unsigned gpio, const char *label)
 {
 	struct gpio_desc	*desc;
 	struct gpio_chip	*chip;
-	int			status = -EPROBE_DEFER;
+	int			status = -EINVAL;
 	unsigned long		flags;
 
 	spin_lock_irqsave(&gpio_lock, flags);
 
 	if (!gpio_is_valid(gpio))
 		goto done;
+	status = -EPROBE_DEFER;
 	desc = &gpio_desc[gpio];
 	chip = desc->chip;
 	if (chip == NULL)

Download attachment "signature.asc" of type "application/pgp-signature" (829 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ