Commit 1d656bd
gpiolib: cdev: add gpio_device locking wrapper around gpio_ioctl()
While the GPIO cdev gpio_ioctl() call is in progress, the kernel can
call gpiochip_remove() which will set gdev->chip to NULL, after which
any subsequent access will cause a crash.
gpio_ioctl() was overlooked by the previous fix to protect syscalls
(bdbbae2), so add protection for that.
Fixes: bdbbae2 ("gpiolib: protect the GPIO device against being dropped while in use by user-space")
Fixes: d7c51b4 ("gpio: userspace ABI for reading/writing GPIO lines")
Fixes: 3c0d9c6 ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
Fixes: aad9558 ("gpiolib: cdev: support GPIO_V2_GET_LINEINFO_IOCTL and GPIO_V2_GET_LINEINFO_WATCH_IOCTL")
Signed-off-by: Kent Gibson <warthog618@gmail.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>1 parent ceb6a6f commit 1d656bd
1 file changed
Lines changed: 12 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2481 | 2481 | | |
2482 | 2482 | | |
2483 | 2483 | | |
2484 | | - | |
2485 | | - | |
2486 | | - | |
2487 | | - | |
| 2484 | + | |
2488 | 2485 | | |
2489 | 2486 | | |
2490 | 2487 | | |
| |||
2521 | 2518 | | |
2522 | 2519 | | |
2523 | 2520 | | |
| 2521 | + | |
| 2522 | + | |
| 2523 | + | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
| 2527 | + | |
| 2528 | + | |
| 2529 | + | |
| 2530 | + | |
| 2531 | + | |
2524 | 2532 | | |
2525 | 2533 | | |
2526 | 2534 | | |
| |||
0 commit comments