mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries
@ 2018-03-04 12:45 Bartosz Golaszewski
  2018-03-19  9:35 ` Bartosz Golaszewski
  2018-03-27 13:14 ` Linus Walleij
  0 siblings, 2 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2018-03-04 12:45 UTC (permalink / raw)
  To: Linus Walleij, Bamvor Jian Zhang
  Cc: linux-gpio, linux-kernel, Bartosz Golaszewski

If we failed to create the top debugfs directory, we must not try to
create the child nodes. We currently only check if gpio_mockup_dbg_dir
is not NULL, but it can also contain an errno if debugfs is disabled
in build options. Use IS_ERR_OR_NULL() instead.

Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
---
 drivers/gpio/gpio-mockup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index 3a545ad17817..b5876b07b0f7 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -314,7 +314,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
 	if (rv)
 		return rv;
 
-	if (gpio_mockup_dbg_dir)
+	if (!IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
 		gpio_mockup_debugfs_setup(dev, chip);
 
 	return 0;
-- 
2.16.1

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries
  2018-03-04 12:45 [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries Bartosz Golaszewski
@ 2018-03-19  9:35 ` Bartosz Golaszewski
  2018-03-27 13:14 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Bartosz Golaszewski @ 2018-03-19  9:35 UTC (permalink / raw)
  To: Linus Walleij; +Cc: linux-gpio, Linux Kernel Mailing List, Bartosz Golaszewski

2018-03-04 13:45 GMT+01:00 Bartosz Golaszewski <brgl@bgdev.pl>:
> If we failed to create the top debugfs directory, we must not try to
> create the child nodes. We currently only check if gpio_mockup_dbg_dir
> is not NULL, but it can also contain an errno if debugfs is disabled
> in build options. Use IS_ERR_OR_NULL() instead.
>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>
> ---
>  drivers/gpio/gpio-mockup.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index 3a545ad17817..b5876b07b0f7 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -314,7 +314,7 @@ static int gpio_mockup_probe(struct platform_device *pdev)
>         if (rv)
>                 return rv;
>
> -       if (gpio_mockup_dbg_dir)
> +       if (!IS_ERR_OR_NULL(gpio_mockup_dbg_dir))
>                 gpio_mockup_debugfs_setup(dev, chip);
>
>         return 0;
> --
> 2.16.1
>

Hi Linus,

gentle ping for this one as it causes a crash if debugfs is disabled.

Bart

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries
  2018-03-04 12:45 [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries Bartosz Golaszewski
  2018-03-19  9:35 ` Bartosz Golaszewski
@ 2018-03-27 13:14 ` Linus Walleij
  1 sibling, 0 replies; 3+ messages in thread
From: Linus Walleij @ 2018-03-27 13:14 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: Bamvor Jian Zhang, open list:GPIO SUBSYSTEM, linux-kernel

On Sun, Mar 4, 2018 at 1:45 PM, Bartosz Golaszewski <brgl@bgdev.pl> wrote:

> If we failed to create the top debugfs directory, we must not try to
> create the child nodes. We currently only check if gpio_mockup_dbg_dir
> is not NULL, but it can also contain an errno if debugfs is disabled
> in build options. Use IS_ERR_OR_NULL() instead.
>
> Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl>

Patch applied.

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-03-27 13:14 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-04 12:45 [PATCH] gpio: mockup: fix a potential crash when creating debugfs entries Bartosz Golaszewski
2018-03-19  9:35 ` Bartosz Golaszewski
2018-03-27 13:14 ` Linus Walleij

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®