All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kent Gibson <warthog618@gmail.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Bartosz Golaszewski <bgolaszewski@baylibre.com>,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Linus Walleij <linus.walleij@linaro.org>,
	Suresh Balakrishnan <suresh.balakrishnan@intel.com>
Subject: Re: [PATCH v1 1/2] gpiolib: Never return internal error codes to user space
Date: Wed, 19 May 2021 07:24:51 +0800	[thread overview]
Message-ID: <20210518232451.GA7362@sol> (raw)
In-Reply-To: <20210518155013.45622-1-andriy.shevchenko@linux.intel.com>

On Tue, May 18, 2021 at 06:50:12PM +0300, Andy Shevchenko wrote:
> 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>
> ---
>  drivers/gpio/gpiolib-cdev.c | 15 ++++++++++++---
>  1 file changed, 12 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-cdev.c b/drivers/gpio/gpiolib-cdev.c
> index 1631727bf0da..1d8f66880d63 100644
> --- a/drivers/gpio/gpiolib-cdev.c
> +++ b/drivers/gpio/gpiolib-cdev.c
> @@ -331,8 +331,11 @@ static int linehandle_create(struct gpio_device *gdev, void __user *ip)
>  		}
>  
>  		ret = gpiod_request(desc, lh->label);
> -		if (ret)
> +		if (ret) {
> +			if (ret == -EPROBE_DEFER)
> +				ret = -ENODEV;
>  			goto out_free_lh;
> +		}
>  		lh->descs[i] = desc;
>  		linehandle_flags_to_desc_flags(handlereq.flags, &desc->flags);
>  
> @@ -1379,8 +1382,11 @@ static int linereq_create(struct gpio_device *gdev, void __user *ip)
>  		}
>  
>  		ret = gpiod_request(desc, lr->label);
> -		if (ret)
> +		if (ret) {
> +			if (ret == -EPROBE_DEFER)
> +				ret = -ENODEV;
>  			goto out_free_linereq;
> +		}
>  
>  		lr->lines[i].desc = desc;
>  		flags = gpio_v2_line_config_flags(lc, i);
> @@ -1765,8 +1771,11 @@ static int lineevent_create(struct gpio_device *gdev, void __user *ip)
>  	}
>  
>  	ret = gpiod_request(desc, le->label);
> -	if (ret)
> +	if (ret) {
> +		if (ret == -EPROBE_DEFER)
> +			ret = -ENODEV;
>  		goto out_free_le;
> +	}
>  	le->desc = desc;
>  	le->eflags = eflags;
>  

You immediately revert this patch in patch 2.
My understanding is that is not allowed within a patch set.
Why split the patches instead of going direct to the new helper?

Cheers,
Kent.

  parent reply	other threads:[~2021-05-18 23:25 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-18 15:50 [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Andy Shevchenko
2021-05-18 15:50 ` [PATCH v1 2/2] gpiolib: Introduce gpiod_request_user() helper Andy Shevchenko
2021-05-25  0:27   ` Linus Walleij
2021-05-18 23:24 ` Kent Gibson [this message]
2021-05-19  7:45   ` [PATCH v1 1/2] gpiolib: Never return internal error codes to user space Andy Shevchenko
2021-05-19  8:04     ` Kent Gibson
2021-05-19  8:30       ` Andy Shevchenko
2021-05-20 13:02         ` Bartosz Golaszewski
2021-05-20 13:14           ` Andy Shevchenko
2021-05-20 14:39             ` Bartosz Golaszewski
2021-11-23 19:15               ` Andy Shevchenko
2021-11-24 12:46                 ` Bartosz Golaszewski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210518232451.GA7362@sol \
    --to=warthog618@gmail.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=bgolaszewski@baylibre.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=suresh.balakrishnan@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.