<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel/linux.git/drivers/gpio/gpiolib-cdev.c, branch v7.1</title>
<subtitle>Linux kernel stable tree (mirror)</subtitle>
<id>https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1</id>
<link rel='self' href='https://git.radix-linux.su/kernel/linux.git/atom?h=v7.1'/>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/'/>
<updated>2026-05-21T10:00:04+00:00</updated>
<entry>
<title>gpio: cdev: check if uAPI v2 config attributes are correctly zeroed</title>
<updated>2026-05-21T10:00:04+00:00</updated>
<author>
<name>Bartosz Golaszewski</name>
<email>bartosz.golaszewski@oss.qualcomm.com</email>
</author>
<published>2026-05-21T08:42:16+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=3e6ccd790ed69bedd3d9626d01dd35cf9821c121'/>
<id>urn:sha1:3e6ccd790ed69bedd3d9626d01dd35cf9821c121</id>
<content type='text'>
We check the padding of other uAPI v2 structures but not that of line
config attributes. For used attributes: check if their padding is
zeroed, for unused: check if the entire structure is zeroed.

Fixes: 3c0d9c635ae2 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
Reviewed-by: Kent Gibson &lt;warthog618@gmail.com&gt;
Link: https://patch.msgid.link/20260521-gpio-cdev-attr-padding-check-v3-1-ec3bcbe2e358@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>gpio: Fix lockdep warnings in gpiolib_{cdev,sysfs}_register()</title>
<updated>2026-03-02T09:11:15+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-02-28T13:14:30+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=fdfe3e72a228b74da21939c47ebd6f5ad4969d5f'/>
<id>urn:sha1:fdfe3e72a228b74da21939c47ebd6f5ad4969d5f</id>
<content type='text'>
A lockdep warning is reported in gpiolib-cdev driver:

  WARNING: drivers/gpio/gpiolib-cdev.c:2735 at
  gpiolib_cdev_register+0x114/0x140, CPU#1: swapper/0/1
  Modules linked in:
  CPU: 1 UID: 0 PID: 1 Comm: swapper/0 Not tainted
  7.0.0-rc1-next-20260227-00065-g6af4b9cfeded #12259 PREEMPT
  Hardware name: Samsung Exynos (Flattened Device Tree)
  Call trace:
    unwind_backtrace from show_stack+0x10/0x14
    show_stack from dump_stack_lvl+0x68/0x88
    dump_stack_lvl from __warn+0x94/0x210
    __warn from warn_slowpath_fmt+0x1b0/0x1bc
    warn_slowpath_fmt from gpiolib_cdev_register+0x114/0x140
    gpiolib_cdev_register from gpiochip_setup_dev+0x4c/0xd0
    gpiochip_setup_dev from gpiochip_add_data_with_key+0x960/0xad4
    gpiochip_add_data_with_key from devm_gpiochip_add_data_with_key+0x20/0x5c

This is because the SRCU wasn't held in gpiolib_cdev_register() when the
caller is from gpiochip_add_data_with_key() instead of
gpiochip_setup_devs().  gpiochip_sysfs_register() shares the similar
concern.

Given that both gpiolib_cdev_register() and gpiochip_sysfs_register()
are only called from gpiolib but no external users.  Remove the lockdep
checks to fix the warnings.

Reported-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Closes: https://lore.kernel.org/all/506ce9b3-d492-4fce-9d02-330e411911e2@samsung.com/
Fixes: cf674f1a0c98 ("gpio: Ensure struct gpio_chip for gpiochip_setup_dev()")
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Tested-by: Marek Szyprowski &lt;m.szyprowski@samsung.com&gt;
Link: https://patch.msgid.link/20260228131430.102388-1-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>gpio: cdev: Don't check struct gpio_chip in gpio_chrdev_open()</title>
<updated>2026-02-27T09:05:21+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-02-23T06:17:25+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=ee68f18d1f0d943d93070eb8cb05598b8b7f0922'/>
<id>urn:sha1:ee68f18d1f0d943d93070eb8cb05598b8b7f0922</id>
<content type='text'>
It's harmless even if: chrdev_open() and cdev_device_del() run at the
same time, and gpio_chrdev_open() gets called after the underlying GPIO
chip has gone.  The subsequent file operations check the availability
of struct gpio_chip anyway.

Don't check struct gpio_chip in gpio_chrdev_open().

Reviewed-by: Linus Walleij &lt;linusw@kernel.org&gt;
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://patch.msgid.link/20260223061726.82161-6-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>gpio: Ensure struct gpio_chip for gpiochip_setup_dev()</title>
<updated>2026-02-27T09:05:21+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-02-23T06:17:24+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=cf674f1a0c9893ee1acef832679562007a94250a'/>
<id>urn:sha1:cf674f1a0c9893ee1acef832679562007a94250a</id>
<content type='text'>
Ensure struct gpio_chip for gpiochip_setup_dev().  This eliminates a few
checks for struct gpio_chip.

Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://patch.msgid.link/20260223061726.82161-5-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>gpio: cdev: convert lineevent_create() and linereq_create() to FD_PREPARE()</title>
<updated>2026-02-23T09:39:07+00:00</updated>
<author>
<name>Kent Gibson</name>
<email>warthog618@gmail.com</email>
</author>
<published>2026-02-16T12:37:09+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=96c02c906a44bc280ef26e343126dd3349d8cae9'/>
<id>urn:sha1:96c02c906a44bc280ef26e343126dd3349d8cae9</id>
<content type='text'>
linehandle_create() was recently converted to use FD_PREPARE() to
simplify fd creation and cleanup logic.
Apply the equivalent conversion to lineevent_create() and
linereq_create().

Signed-off-by: Kent Gibson &lt;warthog618@gmail.com&gt;
Link: https://patch.msgid.link/20260216123709.281444-1-warthog618@gmail.com
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>Convert 'alloc_flex' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T01:06:51+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=323bbfcf1ef8836d0d2ad9e2c1f1c684f0e3b5b3'/>
<id>urn:sha1:323bbfcf1ef8836d0d2ad9e2c1f1c684f0e3b5b3</id>
<content type='text'>
This is the exact same thing as the 'alloc_obj()' version, only much
smaller because there are a lot fewer users of the *alloc_flex()
interface.

As with alloc_obj() version, this was done entirely with mindless brute
force, using the same script, except using 'flex' in the pattern rather
than 'objs*'.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>Convert 'alloc_obj' family to use the new default GFP_KERNEL argument</title>
<updated>2026-02-22T01:09:51+00:00</updated>
<author>
<name>Linus Torvalds</name>
<email>torvalds@linux-foundation.org</email>
</author>
<published>2026-02-22T00:37:42+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43'/>
<id>urn:sha1:bf4afc53b77aeaa48b5409da5c8da6bb4eff7f43</id>
<content type='text'>
This was done entirely with mindless brute force, using

    git grep -l '\&lt;k[vmz]*alloc_objs*(.*, GFP_KERNEL)' |
        xargs sed -i 's/\(alloc_objs*(.*\), GFP_KERNEL)/\1)/'

to convert the new alloc_obj() users that had a simple GFP_KERNEL
argument to just drop that argument.

Note that due to the extreme simplicity of the scripting, any slightly
more complex cases spread over multiple lines would not be triggered:
they definitely exist, but this covers the vast bulk of the cases, and
the resulting diff is also then easier to check automatically.

For the same reason the 'flex' versions will be done as a separate
conversion.

Signed-off-by: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
</content>
</entry>
<entry>
<title>treewide: Replace kmalloc with kmalloc_obj for non-scalar types</title>
<updated>2026-02-21T09:02:28+00:00</updated>
<author>
<name>Kees Cook</name>
<email>kees@kernel.org</email>
</author>
<published>2026-02-21T07:49:23+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=69050f8d6d075dc01af7a5f2f550a8067510366f'/>
<id>urn:sha1:69050f8d6d075dc01af7a5f2f550a8067510366f</id>
<content type='text'>
This is the result of running the Coccinelle script from
scripts/coccinelle/api/kmalloc_objs.cocci. The script is designed to
avoid scalar types (which need careful case-by-case checking), and
instead replace kmalloc-family calls that allocate struct or union
object instances:

Single allocations:	kmalloc(sizeof(TYPE), ...)
are replaced with:	kmalloc_obj(TYPE, ...)

Array allocations:	kmalloc_array(COUNT, sizeof(TYPE), ...)
are replaced with:	kmalloc_objs(TYPE, COUNT, ...)

Flex array allocations:	kmalloc(struct_size(PTR, FAM, COUNT), ...)
are replaced with:	kmalloc_flex(*PTR, FAM, COUNT, ...)

(where TYPE may also be *VAR)

The resulting allocations no longer return "void *", instead returning
"TYPE *".

Signed-off-by: Kees Cook &lt;kees@kernel.org&gt;
</content>
</entry>
<entry>
<title>gpio: cdev: Avoid NULL dereference in linehandle_create()</title>
<updated>2026-02-16T11:20:50+00:00</updated>
<author>
<name>Douglas Anderson</name>
<email>dianders@chromium.org</email>
</author>
<published>2026-02-15T20:05:55+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=6af6be278e3ba2ffb6af5b796c89dfb3f5d9063e'/>
<id>urn:sha1:6af6be278e3ba2ffb6af5b796c89dfb3f5d9063e</id>
<content type='text'>
In linehandle_create(), there is a statement like this:
  retain_and_null_ptr(lh);

Soon after, there is a debug printout that dereferences "lh", which
will crash things.

Avoid the crash by using handlereq.lines, which is the same value.

Fixes: da7e394bf58f ("gpio: convert linehandle_create() to FD_PREPARE()")
Signed-off-by: Douglas Anderson &lt;dianders@chromium.org&gt;
Link: https://patch.msgid.link/20260215120555.v2.1.I77c3eb563271c21870379eefd16ebbc4e09635bb@changeid
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
<entry>
<title>gpio: cdev: Fix resource leaks on errors in gpiolib_cdev_register()</title>
<updated>2026-01-20T09:51:11+00:00</updated>
<author>
<name>Tzung-Bi Shih</name>
<email>tzungbi@kernel.org</email>
</author>
<published>2026-01-20T09:26:50+00:00</published>
<link rel='alternate' type='text/html' href='https://git.radix-linux.su/kernel/linux.git/commit/?id=8a8c942cad4cd12f739a8bb60cac77fd173c4e07'/>
<id>urn:sha1:8a8c942cad4cd12f739a8bb60cac77fd173c4e07</id>
<content type='text'>
On error handling paths, gpiolib_cdev_register() doesn't free the
allocated resources which results leaks.  Fix it.

Cc: stable@vger.kernel.org
Fixes: 7b9b77a8bba9 ("gpiolib: add a per-gpio_device line state notification workqueue")
Fixes: d83cee3d2bb1 ("gpio: protect the pointer to gpio_chip in gpio_device with SRCU")
Signed-off-by: Tzung-Bi Shih &lt;tzungbi@kernel.org&gt;
Link: https://lore.kernel.org/r/20260120092650.2305319-1-tzungbi@kernel.org
Signed-off-by: Bartosz Golaszewski &lt;bartosz.golaszewski@oss.qualcomm.com&gt;
</content>
</entry>
</feed>
