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] [day] [month] [year] [list]
Date:	Wed, 28 Aug 2013 13:13:00 +0200
From:	Linus Walleij <linus.walleij@...aro.org>
To:	Axel Lin <axel.lin@...ics.com>
Cc:	Patrice Chotard <patrice.chotard@...com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/2] pinctrl: core: Add proper mutex lock in pinctrl_request_gpio

On Thu, Aug 22, 2013 at 5:41 AM, Axel Lin <axel.lin@...ics.com> wrote:
> 2013/8/22 Linus Walleij <linus.walleij@...aro.org>:

>>> +       mutex_lock(&pctldev->mutex);
>>> +
>>>         /* Convert to the pin controllers number space */
>>>         pin = gpio_to_pin(range, gpio);
>>>
>>>         ret = pinmux_request_gpio(pctldev, range, pin, gpio);
>>>
>>> +       mutex_unlock(&pctldev->mutex);
>>> +
>>>         return ret;
>>
>> What is this protecting against?
>>
>> I'm not sure I follow this so better ask.
>
> I think this fixes the race between pin_free() and pin_request() calls.
> (Well, I don't have a h/w to test at this moment.)
> It protects accessing the members of pctldev->desc.
> (e.g. update desc->mux_usecount, desc->gpio_owner, desc->mux_owner, etc)
> Current code grabs pctldev->mutex before calling pinmux_free_gpio(),
> but did not grab the mutex while calling pinmux_request_gpio().

OK you won me over, patch applied!

I also edited in some of the above text into the commit.

Yours,
Linus Walleij
--
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