Skip to content

Commit 2c26574

Browse files
committed
Merge tag 'gpio-fixes-for-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux
Pull gpio fixes from Bartosz Golaszewski: - fix a use-after-free bug in GPIO character device code - update MAINTAINERS * tag 'gpio-fixes-for-v6.18-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux: MAINTAINERS: update my email address gpio: cdev: make sure the cdev fd is still active before emitting events
2 parents c6d732c + 2b6d546 commit 2c26574

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

MAINTAINERS

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3926,7 +3926,7 @@ F: crypto/async_tx/
39263926
F: include/linux/async_tx.h
39273927

39283928
AT24 EEPROM DRIVER
3929-
M: Bartosz Golaszewski <brgl@bgdev.pl>
3929+
M: Bartosz Golaszewski <brgl@kernel.org>
39303930
39313931
S: Maintained
39323932
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
@@ -10678,7 +10678,7 @@ F: tools/gpio/gpio-sloppy-logic-analyzer.sh
1067810678

1067910679
GPIO SUBSYSTEM
1068010680
M: Linus Walleij <[email protected]>
10681-
M: Bartosz Golaszewski <brgl@bgdev.pl>
10681+
M: Bartosz Golaszewski <brgl@kernel.org>
1068210682
1068310683
S: Maintained
1068410684
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
@@ -10695,7 +10695,7 @@ K: GPIOD_FLAGS_BIT_NONEXCLUSIVE
1069510695
K: devm_gpiod_unhinge
1069610696

1069710697
GPIO UAPI
10698-
M: Bartosz Golaszewski <brgl@bgdev.pl>
10698+
M: Bartosz Golaszewski <brgl@kernel.org>
1069910699
R: Kent Gibson <[email protected]>
1070010700
1070110701
S: Maintained
@@ -15309,7 +15309,7 @@ F: drivers/pwm/pwm-max7360.c
1530915309
F: include/linux/mfd/max7360.h
1531015310

1531115311
MAXIM MAX77650 PMIC MFD DRIVER
15312-
M: Bartosz Golaszewski <brgl@bgdev.pl>
15312+
M: Bartosz Golaszewski <brgl@kernel.org>
1531315313
1531415314
S: Maintained
1531515315
F: Documentation/devicetree/bindings/*/*max77650.yaml
@@ -19903,7 +19903,7 @@ F: drivers/pci/p2pdma.c
1990319903
F: include/linux/pci-p2pdma.h
1990419904

1990519905
PCI POWER CONTROL
19906-
M: Bartosz Golaszewski <brgl@bgdev.pl>
19906+
M: Bartosz Golaszewski <brgl@kernel.org>
1990719907
1990819908
S: Maintained
1990919909
T: git git://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git
@@ -20500,7 +20500,7 @@ F: include/linux/powercap.h
2050020500
F: kernel/configs/nopm.config
2050120501

2050220502
POWER SEQUENCING
20503-
M: Bartosz Golaszewski <brgl@bgdev.pl>
20503+
M: Bartosz Golaszewski <brgl@kernel.org>
2050420504
2050520505
S: Maintained
2050620506
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git
@@ -21303,7 +21303,7 @@ F: Documentation/tee/qtee.rst
2130321303
F: drivers/tee/qcomtee/
2130421304

2130521305
QUALCOMM TRUST ZONE MEMORY ALLOCATOR
21306-
M: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
21306+
M: Bartosz Golaszewski <brgl@kernel.org>
2130721307
2130821308
S: Maintained
2130921309
F: drivers/firmware/qcom/qcom_tzmem.c
@@ -25671,7 +25671,7 @@ F: Documentation/devicetree/bindings/crypto/ti,am62l-dthev2.yaml
2567125671
F: drivers/crypto/ti/
2567225672

2567325673
TI DAVINCI MACHINE SUPPORT
25674-
M: Bartosz Golaszewski <brgl@bgdev.pl>
25674+
M: Bartosz Golaszewski <brgl@kernel.org>
2567525675
L: [email protected] (moderated for non-subscribers)
2567625676
S: Maintained
2567725677
T: git git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux.git

drivers/gpio/gpiolib-cdev.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2548,10 +2548,17 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
25482548
container_of(nb, struct gpio_chardev_data, lineinfo_changed_nb);
25492549
struct lineinfo_changed_ctx *ctx;
25502550
struct gpio_desc *desc = data;
2551+
struct file *fp;
25512552

25522553
if (!test_bit(gpio_chip_hwgpio(desc), cdev->watched_lines))
25532554
return NOTIFY_DONE;
25542555

2556+
/* Keep the file descriptor alive for the duration of the notification. */
2557+
fp = get_file_active(&cdev->fp);
2558+
if (!fp)
2559+
/* Chardev file descriptor was or is being released. */
2560+
return NOTIFY_DONE;
2561+
25552562
/*
25562563
* If this is called from atomic context (for instance: with a spinlock
25572564
* taken by the atomic notifier chain), any sleeping calls must be done
@@ -2575,8 +2582,6 @@ static int lineinfo_changed_notify(struct notifier_block *nb,
25752582
/* Keep the GPIO device alive until we emit the event. */
25762583
ctx->gdev = gpio_device_get(desc->gdev);
25772584
ctx->cdev = cdev;
2578-
/* Keep the file descriptor alive too. */
2579-
get_file(ctx->cdev->fp);
25802585

25812586
INIT_WORK(&ctx->work, lineinfo_changed_func);
25822587
queue_work(ctx->gdev->line_state_wq, &ctx->work);

0 commit comments

Comments
 (0)