gpio fixes for v6.15-rc7

- fix an interrupt storm on system wake-up in gpio-pca953x
 - fix an out-of-bounds write in gpio-virtuser
 - update MAINTAINERS with an entry for the sloppy logic analyzer
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEFp3rbAvDxGAT0sefEacuoBRx13IFAmgnDl8ACgkQEacuoBRx
 13JHKBAAo9vLLY16Dbn3KmEeLuSn9nOOutCWwop+pNxKS7BkU4AvUNpxj5aqafKq
 0f4mLdvQhiv10OTzwlJDb8SB1xmxyANHKKGkSnMfbd8oQH+pJRRW4whaYuUZLOca
 TbOuUt3NVUTH31V1ZGW0xQdWsc2jUu+9lKQQ8qbCL/474zIG49mlH9/K8FLFJ4Se
 5yT7xthtHNzvdlSp2X3dHHKorNFnqUNaAjj3TDBxkqUP+nLzi4AigvC1gKQMinrE
 Pyh2OOmHxLWeDSedDqZcAHDkgQ/OWJ6JIHjVl/rYZsKb2cDZOhAd0uAtdd4zHpib
 2hmnmx7CXlVB08e8rQJFYFun/znEhdIUrGNtaSRTrNjtIuCF+F1uYW3GY9tdxp7t
 EXBjrHcuOqdVHLrf19sYK/dIKAtLJ200ccE3Bo5WVzFFPZM3A5GcbgI7UW2lVgLM
 dbC7yXWeRpC/aVmLJhR9fLhvmyuiTdXY5iGi0Ps1vajIuBPWdd5BBjXZH5gCfkV1
 1eAMIKWIPXneLY1opD8v5ssKgGZJ7ulrs36LAjs3OsyRmIGY/DwPwe9erz2M5nhQ
 MQ0nvaj38q4kAA02d0eQIkWmWeTQQt7+5nSz2z91/+UTnjJ9XeR/rt4Da2JPepr5
 Z/EmeFvpGO4O1cdUUHXkMOZQ7BskQ6p5VWkxVT3Mt3R6kzopvvw=
 =Qbvo
 -----END PGP SIGNATURE-----

Merge tag 'gpio-fixes-for-v6.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux

Pull gpio fixes from Bartosz Golaszewski:

 - fix an interrupt storm on system wake-up in gpio-pca953x

 - fix an out-of-bounds write in gpio-virtuser

 - update MAINTAINERS with an entry for the sloppy logic analyzer

* tag 'gpio-fixes-for-v6.15-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
  gpio: virtuser: fix potential out-of-bound write
  gpio: pca953x: fix IRQ storm on system wake up
  MAINTAINERS: add me as maintainer for the gpio sloppy logic analyzer
This commit is contained in:
Linus Torvalds 2025-05-16 09:13:51 -07:00
commit 7dc774fde7
3 changed files with 23 additions and 2 deletions

View File

@ -10147,6 +10147,13 @@ F: drivers/gpio/gpio-regmap.c
F: include/linux/gpio/regmap.h
K: (devm_)?gpio_regmap_(un)?register
GPIO SLOPPY LOGIC ANALYZER
M: Wolfram Sang <wsa+renesas@sang-engineering.com>
S: Supported
F: Documentation/dev-tools/gpio-sloppy-logic-analyzer.rst
F: drivers/gpio/gpio-sloppy-logic-analyzer.c
F: tools/gpio/gpio-sloppy-logic-analyzer.sh
GPIO SUBSYSTEM
M: Linus Walleij <linus.walleij@linaro.org>
M: Bartosz Golaszewski <brgl@bgdev.pl>

View File

@ -1204,6 +1204,8 @@ static int pca953x_restore_context(struct pca953x_chip *chip)
guard(mutex)(&chip->i2c_lock);
if (chip->client->irq > 0)
enable_irq(chip->client->irq);
regcache_cache_only(chip->regmap, false);
regcache_mark_dirty(chip->regmap);
ret = pca953x_regcache_sync(chip);
@ -1216,6 +1218,10 @@ static int pca953x_restore_context(struct pca953x_chip *chip)
static void pca953x_save_context(struct pca953x_chip *chip)
{
guard(mutex)(&chip->i2c_lock);
/* Disable IRQ to prevent early triggering while regmap "cache only" is on */
if (chip->client->irq > 0)
disable_irq(chip->client->irq);
regcache_cache_only(chip->regmap, true);
}

View File

@ -401,10 +401,15 @@ static ssize_t gpio_virtuser_direction_do_write(struct file *file,
char buf[32], *trimmed;
int ret, dir, val = 0;
ret = simple_write_to_buffer(buf, sizeof(buf), ppos, user_buf, count);
if (count >= sizeof(buf))
return -EINVAL;
ret = simple_write_to_buffer(buf, sizeof(buf) - 1, ppos, user_buf, count);
if (ret < 0)
return ret;
buf[ret] = '\0';
trimmed = strim(buf);
if (strcmp(trimmed, "input") == 0) {
@ -623,12 +628,15 @@ static ssize_t gpio_virtuser_consumer_write(struct file *file,
char buf[GPIO_VIRTUSER_NAME_BUF_LEN + 2];
int ret;
if (count >= sizeof(buf))
return -EINVAL;
ret = simple_write_to_buffer(buf, GPIO_VIRTUSER_NAME_BUF_LEN, ppos,
user_buf, count);
if (ret < 0)
return ret;
buf[strlen(buf) - 1] = '\0';
buf[ret] = '\0';
ret = gpiod_set_consumer_name(data->ad.desc, buf);
if (ret)