]> git.baikalelectronics.ru Git - kernel.git/commit
gpiolib: Never return internal error codes to user space
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Tue, 1 Feb 2022 15:27:55 +0000 (17:27 +0200)
committerBartosz Golaszewski <brgl@bgdev.pl>
Tue, 8 Feb 2022 09:34:15 +0000 (10:34 +0100)
commitaa3c9d7c4776840d726c6714daf069e4c7b176ba
treea02a6c528be9ef76cdc260be11755e43bf507335
parent2913273097c19492cfb2e34a66c85ba5bfd18113
gpiolib: Never return internal error codes to user space

Currently it's possible that character device interface may return
the error codes which are not supposed to be seen by user space.
In this case it's EPROBE_DEFER.

Wrap it to return -ENODEV instead as sysfs does.

Fixes: ce5d32a63686 ("gpio: userspace ABI for reading/writing GPIO lines")
Fixes: ebf3d31cce6a ("gpio: userspace ABI for reading GPIO line events")
Fixes: 5f251acf7c6a ("gpiolib: cdev: support GPIO_V2_GET_LINE_IOCTL and GPIO_V2_LINE_GET_VALUES_IOCTL")
Reported-by: Suresh Balakrishnan <suresh.balakrishnan@intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
drivers/gpio/gpiolib-cdev.c
drivers/gpio/gpiolib-sysfs.c
drivers/gpio/gpiolib.h