diff options
author | Andy Shevchenko <andriy.shevchenko@linux.intel.com> | 2022-02-01 18:27:55 +0300 |
---|---|---|
committer | Bartosz Golaszewski <brgl@bgdev.pl> | 2022-02-08 12:34:15 +0300 |
commit | 95a4eed7dd5b7c1c3664a626174290686ddbee9f (patch) | |
tree | a02a6c528be9ef76cdc260be11755e43bf507335 /drivers/gpio/gpiolib-sysfs.c | |
parent | 2cba05451a6d0c703bb74f1a250691404f27c4f1 (diff) | |
download | linux-95a4eed7dd5b7c1c3664a626174290686ddbee9f.tar.xz |
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: d7c51b47ac11 ("gpio: userspace ABI for reading/writing GPIO lines")
Fixes: 61f922db7221 ("gpio: userspace ABI for reading GPIO line events")
Fixes: 3c0d9c635ae2 ("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>
Diffstat (limited to 'drivers/gpio/gpiolib-sysfs.c')
-rw-r--r-- | drivers/gpio/gpiolib-sysfs.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c index 4098bc7f88b7..44c1ad51b3fe 100644 --- a/drivers/gpio/gpiolib-sysfs.c +++ b/drivers/gpio/gpiolib-sysfs.c @@ -475,12 +475,9 @@ static ssize_t export_store(struct class *class, * they may be undone on its behalf too. */ - status = gpiod_request(desc, "sysfs"); - if (status) { - if (status == -EPROBE_DEFER) - status = -ENODEV; + status = gpiod_request_user(desc, "sysfs"); + if (status) goto done; - } status = gpiod_set_transitory(desc, false); if (!status) { |