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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 20 Mar 2013 15:19:08 +0100
From:	Richard Genoud <richard.genoud@...il.com>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Linus Walleij <linus.walleij@...aro.org>,
	Stephen Warren <swarren@...dia.com>,
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH] BUG: pinmux: release only taken pins on error

2013/3/20 Axel Lin <axel.lin@...ics.com>:
> 2013/3/20 Richard Genoud <richard.genoud@...il.com>:
>> commit e38d457de7be63e6ced1ea254aa51466deb1fef0
>> pinctrl: pinmux: Release all taken pins in pinmux_enable_setting
>>
>> Introduced a bug in the release pin mechanism.
>> All the pins (taken or not) where released.
>> For instance, if a i2c function has already taken pins 5 and 6.
>> And the pins of function PHY are requested (pins 3 4 5 6 7).
>> The pins 3 and 4 will be taken, pin 5 is already taken, so the function
>> fails.
>> And we have pins 3 and 4 release, which is ok. But also pins 5 and 6 !.
>> And also pin 7 (which will have its mux_usecount to -1...)
>>
>> This patch reset the original behaviour.
>>
>> Signed-off-by: Richard Genoud <richard.genoud@...il.com>
>> ---
>>  drivers/pinctrl/pinmux.c |    2 ++
>>  1 files changed, 2 insertions(+), 0 deletions(-)
>>
>> diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
>> index 1a00658..917e830 100644
>> --- a/drivers/pinctrl/pinmux.c
>> +++ b/drivers/pinctrl/pinmux.c
>> @@ -409,6 +409,8 @@ int pinmux_enable_setting(struct pinctrl_setting const *setting)
>>                         dev_err(pctldev->dev,
>>                                 "could not request pin %d on device %s\n",
>>                                 pins[i], pinctrl_dev_get_name(pctldev));
>> +                       /* On error release *only* taken pins */
>> +                       num_pins = i - 1; /* this pin just failed */
> This seems pointless, in the goto err_pin_request path, the code does
> not use num_pins variable at all.
>
>>                         goto err_pin_request;
>
> see the code in err_pin_request,
> it actually does "while (--i>-0", so it won't call pin_free for the
> just failed pin.
>
> err_pin_request:
>         /* On error release all taken pins */
>         while (--i >= 0)
>                 pin_free(pctldev, pins[i], NULL);
>
>         return ret;

arrrrgg !
it's only Wednesday, and I'm already doing such mistakes !
sorry for that...
This patch can be tossed away with no regret.

The other 2 patches are better I guess
--
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