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]
Message-ID: <CACRpkdZaU_0R-giZnskPM=5XxKks9JbRH-cvLRSr55KBucUs-g@mail.gmail.com>
Date:   Fri, 20 Jan 2017 09:48:13 +0100
From:   Linus Walleij <linus.walleij@...aro.org>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
Cc:     Mika Westerberg <mika.westerberg@...ux.intel.com>,
        Alexandre Courbot <gnurou@...il.com>,
        "linux-gpio@...r.kernel.org" <linux-gpio@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 2/3] pinctrl: Allow configuration of pins from gpiolib
 based drivers

On Thu, Jan 19, 2017 at 1:11 PM, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com> wrote:
> On Thu, 2017-01-19 at 12:48 +0300, Mika Westerberg wrote:
>> When a GPIO driver is backed by a pinctrl driver the GPIO driver
>> sometimes needs to call the pinctrl driver to configure certain
>> things,
>> like whether the pin is used as input or output. In addition to this
>> there are other configurations applicable to GPIOs such as setting
>> debounce time of the GPIO.
>>
>> To support this we introduce a new function pinctrl_gpio_set_config()
>> that can be used by gpiolib based driver to pass configuration
>> requests
>> to the backing pinctrl driver.
>
>
>> +     mutex_lock(&pctldev->mutex);
>> +     pin = gpio_to_pin(range, gpio);
>> +     ret = pinconf_set_config(pctldev, pin, configs,
>> ARRAY_SIZE(configs));
>> +     mutex_unlock(&pctldev->mutex);
>
> Does gpio_to_pin() require to be under lock?

All other callers do that because:

commit 9b77ace409e1419c331209c4c8eb2c8bc990e9fd
Author: Axel Lin <axel.lin@...ics.com>
Date:   Mon Aug 19 10:07:46 2013 +0800

    pinctrl: core: Add proper mutex lock in pinctrl_request_gpio

    This one is missed in commit 42fed7ba "pinctrl: move subsystem mutex to
    pinctrl_dev struct".

    I think this fixes the race between pin_free() and pin_request() calls.
    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().

    Signed-off-by: Axel Lin <axel.lin@...ics.com>
    Signed-off-by: Linus Walleij <linus.walleij@...aro.org>

Yours,
Linus Walleij

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ