[PATCH v4 0/6] gpio: Refactor and add selftest

Tzung-Bi Shih posted 6 patches 1 month, 3 weeks ago
drivers/gpio/gpiolib-cdev.c                   |  20 +-
drivers/gpio/gpiolib-cdev.h                   |   2 +-
drivers/gpio/gpiolib-sysfs.c                  |  32 +-
drivers/gpio/gpiolib-sysfs.h                  |   8 +-
drivers/gpio/gpiolib.c                        |  46 +--
tools/testing/selftests/gpio/Makefile         |   5 +-
tools/testing/selftests/gpio/gpio-cdev-uaf.c  | 292 ++++++++++++++++++
tools/testing/selftests/gpio/gpio-cdev-uaf.sh |  63 ++++
8 files changed, 402 insertions(+), 66 deletions(-)
create mode 100644 tools/testing/selftests/gpio/gpio-cdev-uaf.c
create mode 100755 tools/testing/selftests/gpio/gpio-cdev-uaf.sh
[PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Tzung-Bi Shih 1 month, 3 weeks ago
The series is separated from v3 to lessen the burden on the subsequent
revocable work per suggestion in
https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.

The series is based on v7.0-rc1 and applies after
https://lore.kernel.org/all/20260205092840.2574840-1-tzungbi@kernel.org.

---
v4:
- Separate the first 6 patches from v3.

v3: https://lore.kernel.org/all/20260213092958.864411-1-tzungbi@kernel.org

Tzung-Bi Shih (6):
  gpio: Access `gpio_bus_type` in gpiochip_setup_dev()
  gpio: Remove redundant check for struct gpio_chip
  gpio: sysfs: Remove redundant check for struct gpio_chip
  gpio: Ensure struct gpio_chip for gpiochip_setup_dev()
  gpio: cdev: Don't check struct gpio_chip in gpio_chrdev_open()
  selftests: gpio: Add gpio-cdev-uaf tests

 drivers/gpio/gpiolib-cdev.c                   |  20 +-
 drivers/gpio/gpiolib-cdev.h                   |   2 +-
 drivers/gpio/gpiolib-sysfs.c                  |  32 +-
 drivers/gpio/gpiolib-sysfs.h                  |   8 +-
 drivers/gpio/gpiolib.c                        |  46 +--
 tools/testing/selftests/gpio/Makefile         |   5 +-
 tools/testing/selftests/gpio/gpio-cdev-uaf.c  | 292 ++++++++++++++++++
 tools/testing/selftests/gpio/gpio-cdev-uaf.sh |  63 ++++
 8 files changed, 402 insertions(+), 66 deletions(-)
 create mode 100644 tools/testing/selftests/gpio/gpio-cdev-uaf.c
 create mode 100755 tools/testing/selftests/gpio/gpio-cdev-uaf.sh

-- 
2.51.0
Re: [PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Linus Walleij 1 month, 2 weeks ago
On Mon, Feb 23, 2026 at 7:17 AM Tzung-Bi Shih <tzungbi@kernel.org> wrote:

> The series is separated from v3 to lessen the burden on the subsequent
> revocable work per suggestion in
> https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.

No matter if revocable goes anywhere or not, this is excellent
maintenance work, thanks Tzung-Bi!

Yours,
Linus Walleij
Re: [PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
On Mon, 23 Feb 2026 14:17:20 +0800, Tzung-Bi Shih wrote:
> The series is separated from v3 to lessen the burden on the subsequent
> revocable work per suggestion in
> https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.
> 
> The series is based on v7.0-rc1 and applies after
> https://lore.kernel.org/all/20260205092840.2574840-1-tzungbi@kernel.org.
> 
> [...]

Applied, thanks!

[1/6] gpio: Access `gpio_bus_type` in gpiochip_setup_dev()
      https://git.kernel.org/brgl/c/cc11f4ef666fbca02c8a2f11d0184d57e6b75579
[2/6] gpio: Remove redundant check for struct gpio_chip
      https://git.kernel.org/brgl/c/049f71131734c47a6aaca2472273aef2cd17a6d8
[3/6] gpio: sysfs: Remove redundant check for struct gpio_chip
      https://git.kernel.org/brgl/c/395b8e555dfcbab6b28f360e39bd048b2f3e362b
[4/6] gpio: Ensure struct gpio_chip for gpiochip_setup_dev()
      https://git.kernel.org/brgl/c/cf674f1a0c9893ee1acef832679562007a94250a
[5/6] gpio: cdev: Don't check struct gpio_chip in gpio_chrdev_open()
      https://git.kernel.org/brgl/c/ee68f18d1f0d943d93070eb8cb05598b8b7f0922
[6/6] selftests: gpio: Add gpio-cdev-uaf tests
      https://git.kernel.org/brgl/c/c7f92042d3f3d4f084794f5314fa10366084179c

Best regards,
-- 
Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Re: [PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
On Mon, 23 Feb 2026 07:17:20 +0100, Tzung-Bi Shih <tzungbi@kernel.org> said:
> The series is separated from v3 to lessen the burden on the subsequent
> revocable work per suggestion in
> https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.
>
> The series is based on v7.0-rc1 and applies after
> https://lore.kernel.org/all/20260205092840.2574840-1-tzungbi@kernel.org.
>
> ---
> v4:
> - Separate the first 6 patches from v3.
>
> v3: https://lore.kernel.org/all/20260213092958.864411-1-tzungbi@kernel.org
>
> Tzung-Bi Shih (6):
>   gpio: Access `gpio_bus_type` in gpiochip_setup_dev()
>   gpio: Remove redundant check for struct gpio_chip
>   gpio: sysfs: Remove redundant check for struct gpio_chip
>   gpio: Ensure struct gpio_chip for gpiochip_setup_dev()
>   gpio: cdev: Don't check struct gpio_chip in gpio_chrdev_open()
>   selftests: gpio: Add gpio-cdev-uaf tests
>
>  drivers/gpio/gpiolib-cdev.c                   |  20 +-
>  drivers/gpio/gpiolib-cdev.h                   |   2 +-
>  drivers/gpio/gpiolib-sysfs.c                  |  32 +-
>  drivers/gpio/gpiolib-sysfs.h                  |   8 +-
>  drivers/gpio/gpiolib.c                        |  46 +--
>  tools/testing/selftests/gpio/Makefile         |   5 +-
>  tools/testing/selftests/gpio/gpio-cdev-uaf.c  | 292 ++++++++++++++++++
>  tools/testing/selftests/gpio/gpio-cdev-uaf.sh |  63 ++++
>  8 files changed, 402 insertions(+), 66 deletions(-)
>  create mode 100644 tools/testing/selftests/gpio/gpio-cdev-uaf.c
>  create mode 100755 tools/testing/selftests/gpio/gpio-cdev-uaf.sh
>
> --
> 2.51.0
>
>

Hi Tzung-Bi!

This no longer applies on top of current linux-next. Could you please rabase
and resend?

Thanks!
Bart
Re: [PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Tzung-Bi Shih 1 month, 2 weeks ago
On Wed, Feb 25, 2026 at 02:26:19AM -0800, Bartosz Golaszewski wrote:
> On Mon, 23 Feb 2026 07:17:20 +0100, Tzung-Bi Shih <tzungbi@kernel.org> said:
> > The series is separated from v3 to lessen the burden on the subsequent
> > revocable work per suggestion in
> > https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.
> >
> > The series is based on v7.0-rc1 and applies after
> > https://lore.kernel.org/all/20260205092840.2574840-1-tzungbi@kernel.org.
[...]
> 
> This no longer applies on top of current linux-next. Could you please rabase
> and resend?

Did you try to apply the series after applying "[PATCH v3] gpio: Fix resource
leaks on errors in gpiochip_add_data_with_key()" (link above)?

Tried on next-20260225; the 1+6 patches apply.
Re: [PATCH v4 0/6] gpio: Refactor and add selftest
Posted by Bartosz Golaszewski 1 month, 2 weeks ago
On Thu, Feb 26, 2026 at 1:44 PM Tzung-Bi Shih <tzungbi@kernel.org> wrote:
>
> On Wed, Feb 25, 2026 at 02:26:19AM -0800, Bartosz Golaszewski wrote:
> > On Mon, 23 Feb 2026 07:17:20 +0100, Tzung-Bi Shih <tzungbi@kernel.org> said:
> > > The series is separated from v3 to lessen the burden on the subsequent
> > > revocable work per suggestion in
> > > https://lore.kernel.org/all/CAMRc=MfQumD1ULx7yU4W2sx=35wyQf7-v4tSf44OqEu3JDBUAg@mail.gmail.com/.
> > >
> > > The series is based on v7.0-rc1 and applies after
> > > https://lore.kernel.org/all/20260205092840.2574840-1-tzungbi@kernel.org.
> [...]
> >
> > This no longer applies on top of current linux-next. Could you please rabase
> > and resend?
>
> Did you try to apply the series after applying "[PATCH v3] gpio: Fix resource
> leaks on errors in gpiochip_add_data_with_key()" (link above)?
>
> Tried on next-20260225; the 1+6 patches apply.

Sorry for the noise, I should have reread the cover letter.

Bart