<feed xmlns='http://www.w3.org/2005/Atom'>
<title>user/sven/linux.git/include/linux/gpio, branch v4.20.9</title>
<subtitle>Linux Kernel
</subtitle>
<id>https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.20.9</id>
<link rel='self' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/atom?h=v4.20.9'/>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/'/>
<updated>2019-02-12T19:02:04Z</updated>
<entry>
<title>gpiolib: Fix possible use after free on label</title>
<updated>2019-02-12T19:02:04Z</updated>
<author>
<name>Muchun Song</name>
<email>smuchun@gmail.com</email>
</author>
<published>2018-11-01T13:12:50Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4672971c827e043c0d0b3ffc955309370487621f'/>
<id>urn:sha1:4672971c827e043c0d0b3ffc955309370487621f</id>
<content type='text'>
[ Upstream commit 18534df419041e6c1f4b41af56ee7d41f757815c ]

gpiod_request_commit() copies the pointer to the label passed as
an argument only to be used later. But there's a chance the caller
could immediately free the passed string(e.g., local variable).
This could trigger a use after free when we use gpio label(e.g.,
gpiochip_unlock_as_irq(), gpiochip_is_requested()).

To be on the safe side: duplicate the string with kstrdup_const()
so that if an unaware user passes an address to a stack-allocated
buffer, we won't get the arbitrary label.

Also fix gpiod_set_consumer_name().

Signed-off-by: Muchun Song &lt;smuchun@gmail.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio</title>
<updated>2018-10-23T07:45:05Z</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2018-10-23T07:45:05Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=114b5f8f7efc036dd7dd16efb0f218a88e6c6c02'/>
<id>urn:sha1:114b5f8f7efc036dd7dd16efb0f218a88e6c6c02</id>
<content type='text'>
Pull GPIO updates from Linus Walleij:
 "This is the bulk of GPIO changes for the v4.20 series:

  Core changes:

   - A patch series from Hans Verkuil to make it possible to
     enable/disable IRQs on a GPIO line at runtime and drive GPIO lines
     as output without having to put/get them from scratch.

     The irqchip callbacks have been improved so that they can use only
     the fastpatch callbacks to enable/disable irqs like any normal
     irqchip, especially the gpiod_lock_as_irq() has been improved to be
     callable in fastpath context.

     A bunch of rework had to be done to achieve this but it is a big
     win since I never liked to restrict this to slowpath. The only call
     requireing slowpath was try_module_get() and this is kept at the
     .request_resources() slowpath callback. In the GPIO CEC driver this
     is a big win sine a single line is used for both outgoing and
     incoming traffic, and this needs to use IRQs for incoming traffic
     while actively driving the line for outgoing traffic.

   - Janusz Krzysztofik improved the GPIO array API to pass a "cookie"
     (struct gpio_array) and a bitmap for setting or getting multiple
     GPIO lines at once.

     This improvement orginated in a specific need to speed up an OMAP1
     driver and has led to a much better API and real performance gains
     when the state of the array can be used to bypass a lot of checks
     and code when we want things to go really fast.

     The previous code would minimize the number of calls down to the
     driver callbacks assuming the CPU speed was orders of magnitude
     faster than the I/O latency, but this assumption was wrong on
     several platforms: what we needed to do was to profile and improve
     the speed on the hot path of the array functions and this change is
     now completed.

   - Clean out the painful and hard to grasp BNF experiments from the
     device tree bindings. Future approaches are looking into using JSON
     schema for this purpose. (Rob Herring is floating a patch series.)

  New drivers:

   - The RCAR driver now supports r8a774a1 (RZ/G2M).

   - Synopsys GPIO via CREGs driver.

  Major improvements:

   - Modernization of the EP93xx driver to use irqdomain and other
     contemporary concepts.

   - The ingenic driver has been merged into the Ingenic pin control
     driver and removed from the GPIO subsystem.

   - Debounce support in the ftgpio010 driver"

* tag 'gpio-v4.20-1' of git://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio: (116 commits)
  gpio: Clarify kerneldoc on gpiochip_set_chained_irqchip()
  gpio: Remove unused 'irqchip' argument to gpiochip_set_cascaded_irqchip()
  gpio: Drop parent irq assignment during cascade setup
  mmc: pwrseq_simple: Fix incorrect handling of GPIO bitmap
  gpio: fix SNPS_CREG kconfig dependency warning
  gpiolib: Initialize gdev field before is used
  gpio: fix kernel-doc after devres.c file rename
  gpio: fix doc string for devm_gpiochip_add_data() to not talk about irq_chip
  gpio: syscon: Fix possible NULL ptr usage
  gpiolib: Show correct direction from the beginning
  pinctrl: msm: Use init_valid_mask exported function
  gpiolib: Add init_valid_mask exported function
  GPIO: add single-register GPIO via CREG driver
  dt-bindings: Document the Synopsys GPIO via CREG bindings
  gpio: mockup: use device properties instead of platform_data
  gpio: Slightly more helpful debugfs
  gpio: omap: Remove set but not used variable 'dev'
  gpio: omap: drop omap_gpio_list
  Accept partial 'gpio-line-names' property.
  gpio: omap: get rid of the conditional PM runtime calls
  ...
</content>
</entry>
<entry>
<title>Merge branch 'regulator-4.20' into regulator-next</title>
<updated>2018-10-21T16:00:02Z</updated>
<author>
<name>Mark Brown</name>
<email>broonie@kernel.org</email>
</author>
<published>2018-10-21T16:00:02Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=4fd1f509e89f0e8ea28b1baa41d314636ae2064e'/>
<id>urn:sha1:4fd1f509e89f0e8ea28b1baa41d314636ae2064e</id>
<content type='text'>
</content>
</entry>
<entry>
<title>regulator/gpio: Allow nonexclusive GPIO access</title>
<updated>2018-10-12T16:55:02Z</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2018-10-12T12:54:12Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=b0ce7b29bfcd090ddba476f45a75ec0a797b048a'/>
<id>urn:sha1:b0ce7b29bfcd090ddba476f45a75ec0a797b048a</id>
<content type='text'>
This allows nonexclusive (simultaneous) access to a single
GPIO line for the fixed regulator enable line. This happens
when several regulators use the same GPIO for enabling and
disabling a regulator, and all need a handle on their GPIO
descriptor.

This solution with a special flag is not entirely elegant
and should ideally be replaced by something more careful as
this makes it possible for several consumers to
enable/disable the same GPIO line to the left and right
without any consistency. The current use inside the regulator
core should however be fine as it takes special care to
handle this.

For the state of the GPIO backend, this is still the
lesser evil compared to going back to global GPIO
numbers.

Cc: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Cc: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Fixes: efdfeb079cc3 ("regulator: fixed: Convert to use GPIO descriptor only")
Reported-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Tested-by: Jon Hunter &lt;jonathanh@nvidia.com&gt;
Tested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
Signed-off-by: Mark Brown &lt;broonie@kernel.org&gt;
</content>
</entry>
<entry>
<title>gpio: Assign gpio_irq_chip::parents to non-stack pointer</title>
<updated>2018-10-10T12:03:27Z</updated>
<author>
<name>Stephen Boyd</name>
<email>swboyd@chromium.org</email>
</author>
<published>2018-10-08T16:32:13Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3e779a2e7f909015f21428b66834127496110b6d'/>
<id>urn:sha1:3e779a2e7f909015f21428b66834127496110b6d</id>
<content type='text'>
gpiochip_set_cascaded_irqchip() is passed 'parent_irq' as an argument
and then the address of that argument is assigned to the gpio chips
gpio_irq_chip 'parents' pointer shortly thereafter. This can't ever
work, because we've just assigned some stack address to a pointer that
we plan to dereference later in gpiochip_irq_map(). I ran into this
issue with the KASAN report below when gpiochip_irq_map() tried to setup
the parent irq with a total junk pointer for the 'parents' array.

BUG: KASAN: stack-out-of-bounds in gpiochip_irq_map+0x228/0x248
Read of size 4 at addr ffffffc0dde472e0 by task swapper/0/1

CPU: 7 PID: 1 Comm: swapper/0 Not tainted 4.14.72 #34
Call trace:
[&lt;ffffff9008093638&gt;] dump_backtrace+0x0/0x718
[&lt;ffffff9008093da4&gt;] show_stack+0x20/0x2c
[&lt;ffffff90096b9224&gt;] __dump_stack+0x20/0x28
[&lt;ffffff90096b91c8&gt;] dump_stack+0x80/0xbc
[&lt;ffffff900845a350&gt;] print_address_description+0x70/0x238
[&lt;ffffff900845a8e4&gt;] kasan_report+0x1cc/0x260
[&lt;ffffff900845aa14&gt;] __asan_report_load4_noabort+0x2c/0x38
[&lt;ffffff900897e098&gt;] gpiochip_irq_map+0x228/0x248
[&lt;ffffff900820cc08&gt;] irq_domain_associate+0x114/0x2ec
[&lt;ffffff900820d13c&gt;] irq_create_mapping+0x120/0x234
[&lt;ffffff900820da78&gt;] irq_create_fwspec_mapping+0x4c8/0x88c
[&lt;ffffff900820e2d8&gt;] irq_create_of_mapping+0x180/0x210
[&lt;ffffff900917114c&gt;] of_irq_get+0x138/0x198
[&lt;ffffff9008dc70ac&gt;] spi_drv_probe+0x94/0x178
[&lt;ffffff9008ca5168&gt;] driver_probe_device+0x51c/0x824
[&lt;ffffff9008ca6538&gt;] __device_attach_driver+0x148/0x20c
[&lt;ffffff9008ca14cc&gt;] bus_for_each_drv+0x120/0x188
[&lt;ffffff9008ca570c&gt;] __device_attach+0x19c/0x2dc
[&lt;ffffff9008ca586c&gt;] device_initial_probe+0x20/0x2c
[&lt;ffffff9008ca18bc&gt;] bus_probe_device+0x80/0x154
[&lt;ffffff9008c9b9b4&gt;] device_add+0x9b8/0xbdc
[&lt;ffffff9008dc7640&gt;] spi_add_device+0x1b8/0x380
[&lt;ffffff9008dcbaf0&gt;] spi_register_controller+0x111c/0x1378
[&lt;ffffff9008dd6b10&gt;] spi_geni_probe+0x4dc/0x6f8
[&lt;ffffff9008cab058&gt;] platform_drv_probe+0xdc/0x130
[&lt;ffffff9008ca5168&gt;] driver_probe_device+0x51c/0x824
[&lt;ffffff9008ca59cc&gt;] __driver_attach+0x100/0x194
[&lt;ffffff9008ca0ea8&gt;] bus_for_each_dev+0x104/0x16c
[&lt;ffffff9008ca58c0&gt;] driver_attach+0x48/0x54
[&lt;ffffff9008ca1edc&gt;] bus_add_driver+0x274/0x498
[&lt;ffffff9008ca8448&gt;] driver_register+0x1ac/0x230
[&lt;ffffff9008caaf6c&gt;] __platform_driver_register+0xcc/0xdc
[&lt;ffffff9009c4b33c&gt;] spi_geni_driver_init+0x1c/0x24
[&lt;ffffff9008084cb8&gt;] do_one_initcall+0x240/0x3dc
[&lt;ffffff9009c017d0&gt;] kernel_init_freeable+0x378/0x468
[&lt;ffffff90096e8240&gt;] kernel_init+0x14/0x110
[&lt;ffffff9008086fcc&gt;] ret_from_fork+0x10/0x18

The buggy address belongs to the page:
page:ffffffbf037791c0 count:0 mapcount:0 mapping:          (null) index:0x0
flags: 0x4000000000000000()
raw: 4000000000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: ffffffbf037791e0 ffffffbf037791e0 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffffffc0dde47180: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffffc0dde47200: f1 f1 f1 f1 f8 f8 f8 f8 f8 f8 f8 f8 f8 f8 f2 f2
&gt;ffffffc0dde47280: f2 f2 00 00 00 00 00 00 00 00 00 00 f3 f3 f3 f3
                                                       ^
 ffffffc0dde47300: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffffffc0dde47380: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00

Let's leave around one unsigned int in the gpio_irq_chip struct for the
single parent irq case and repoint the 'parents' array at it. This way
code is left mostly intact to setup parents and we waste an extra few
bytes per structure of which there should be only a handful in a system.

Cc: Evan Green &lt;evgreen@chromium.org&gt;
Cc: Thierry Reding &lt;treding@nvidia.com&gt;
Cc: Grygorii Strashko &lt;grygorii.strashko@ti.com&gt;
Fixes: e0d897289813 ("gpio: Implement tighter IRQ chip integration")
Signed-off-by: Stephen Boyd &lt;swboyd@chromium.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpiolib: Add init_valid_mask exported function</title>
<updated>2018-10-10T08:31:40Z</updated>
<author>
<name>Ricardo Ribalda Delgado</name>
<email>ricardo.ribalda@gmail.com</email>
</author>
<published>2018-10-05T06:52:58Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=f8ec92a9f63b3b11e399409141b7868bb405e6b5'/>
<id>urn:sha1:f8ec92a9f63b3b11e399409141b7868bb405e6b5</id>
<content type='text'>
Add a function that allows initializing the valid_mask from
gpiochip_add_data.

This prevents race conditions during gpiochip initialization.

If the function is not exported, then the old behaviour is respected,
this is, set all gpios as valid.

Signed-off-by: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Tested-by: Jeffrey Hugo &lt;jhugo@codeaurora.org&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio: Restore indentation of continued lines</title>
<updated>2018-10-01T10:22:41Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2018-09-27T11:38:10Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=3c940660cb1ea6c952bb863040cdacafd5077448'/>
<id>urn:sha1:3c940660cb1ea6c952bb863040cdacafd5077448</id>
<content type='text'>
Fixes: 3027743f83f867d8 ("gpio: Remove VLA from gpiolib")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio: Propagate errors from gpiod_set_array_value_complex()</title>
<updated>2018-10-01T10:22:15Z</updated>
<author>
<name>Geert Uytterhoeven</name>
<email>geert+renesas@glider.be</email>
</author>
<published>2018-09-27T11:38:09Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=cf9af0d5786c008971148f4e06567a98f6a7f9d0'/>
<id>urn:sha1:cf9af0d5786c008971148f4e06567a98f6a7f9d0</id>
<content type='text'>
Internal helper function gpiod_set_array_value_complex() was changed to
return an error value, but not all gpiolib callers were updated to
propagate the new error up.

Fixes: 3027743f83f867d8 ("gpio: Remove VLA from gpiolib")
Signed-off-by: Geert Uytterhoeven &lt;geert+renesas@glider.be&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>gpio: Add comments on single direction chips</title>
<updated>2018-09-25T07:54:14Z</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2018-09-25T07:54:14Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=e48d194d1204b19655c1a9d78a67f2f01d2fe432'/>
<id>urn:sha1:e48d194d1204b19655c1a9d78a67f2f01d2fe432</id>
<content type='text'>
A patch from Ricardo got me thinking about some gpio chip
semantics so let's drop in some comments to make things
more clear around that.

Cc: Ricardo Ribalda Delgado &lt;ricardo.ribalda@gmail.com&gt;
Cc: Bartosz Golaszewski &lt;brgl@bgdev.pl&gt;
Signed-off-by: Linus Walleij &lt;linus.walleij@linaro.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'ib-array-bitmaps' into devel</title>
<updated>2018-09-20T15:36:36Z</updated>
<author>
<name>Linus Walleij</name>
<email>linus.walleij@linaro.org</email>
</author>
<published>2018-09-20T15:36:36Z</published>
<link rel='alternate' type='text/html' href='https://git.stealer.net/cgit.cgi/user/sven/linux.git/commit/?id=a2ab1703748197b166c85b40d08a8d1fb612f55b'/>
<id>urn:sha1:a2ab1703748197b166c85b40d08a8d1fb612f55b</id>
<content type='text'>
</content>
</entry>
</feed>
