gpio: mockup: fix a potential crash when creating debugfs entries
Subsystems (2)
PATCH 1/1 gpio: mockup: fix a potential crash when creating debugfs entries
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.
--- drivers/gpio/gpio-mockup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/gpio/gpio-mockup.c +1 -1
@@ -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 ;
Signature · 1 line
2.16.1
2018-03-04 13:45 GMT+01:00 Bartosz Golaszewski <[email protected]>:
Quoted 24 lines
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_diris not NULL, but it can also contain an errno if debugfs is disabled in build options. UseIS_ERR_OR_NULL()instead.Signed-off-by Bartosz Golaszewski <[email protected]>--- drivers/gpio/gpio-mockup.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/gpio/gpio-mockup.c +1
-2@@ -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 ; --
Quoted 2 lines
2.16.1
Hi Linus,
gentle ping for this one as it causes a crash if debugfs is disabled.
Bart
Quoted 6 lines · 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_diris not NULL, but it can also contain an errno if debugfs is disabled in build options. UseIS_ERR_OR_NULL()instead.Signed-off-by Bartosz Golaszewski <[email protected]>
Patch applied.
Yours,
Linus Walleij