* [PATCH v1 1/1] gpio: mockup: Fix potential resource leakage when register a chip
@ 2022-09-20 13:30 Andy Shevchenko
2022-09-20 14:08 ` Bartosz Golaszewski
0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2022-09-20 13:30 UTC (permalink / raw)
To: Andy Shevchenko, Bartosz Golaszewski, linux-gpio, linux-kernel
Cc: Bamvor Jian Zhang, Linus Walleij
If creation of software node fails, the locally allocated string
array is left unfreed. Free it on error path.
Fixes: 6fda593f3082 ("gpio: mockup: Convert to use software nodes")
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
drivers/gpio/gpio-mockup.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index a2e505a7545c..d6e42159fe44 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -533,8 +533,10 @@ static int __init gpio_mockup_register_chip(int idx)
}
fwnode = fwnode_create_software_node(properties, NULL);
- if (IS_ERR(fwnode))
+ if (IS_ERR(fwnode)) {
+ kfree_strarray(line_names, ngpio);
return PTR_ERR(fwnode);
+ }
pdevinfo.name = "gpio-mockup";
pdevinfo.id = idx;
--
2.35.1
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH v1 1/1] gpio: mockup: Fix potential resource leakage when register a chip
2022-09-20 13:30 [PATCH v1 1/1] gpio: mockup: Fix potential resource leakage when register a chip Andy Shevchenko
@ 2022-09-20 14:08 ` Bartosz Golaszewski
0 siblings, 0 replies; 2+ messages in thread
From: Bartosz Golaszewski @ 2022-09-20 14:08 UTC (permalink / raw)
To: Andy Shevchenko
Cc: linux-gpio, linux-kernel, Bamvor Jian Zhang, Linus Walleij
On Tue, Sep 20, 2022 at 3:30 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> If creation of software node fails, the locally allocated string
> array is left unfreed. Free it on error path.
>
> Fixes: 6fda593f3082 ("gpio: mockup: Convert to use software nodes")
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
> drivers/gpio/gpio-mockup.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
> index a2e505a7545c..d6e42159fe44 100644
> --- a/drivers/gpio/gpio-mockup.c
> +++ b/drivers/gpio/gpio-mockup.c
> @@ -533,8 +533,10 @@ static int __init gpio_mockup_register_chip(int idx)
> }
>
> fwnode = fwnode_create_software_node(properties, NULL);
> - if (IS_ERR(fwnode))
> + if (IS_ERR(fwnode)) {
> + kfree_strarray(line_names, ngpio);
> return PTR_ERR(fwnode);
> + }
>
> pdevinfo.name = "gpio-mockup";
> pdevinfo.id = idx;
> --
> 2.35.1
>
Queued for fixes.
Bart
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-09-20 14:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-09-20 13:30 [PATCH v1 1/1] gpio: mockup: Fix potential resource leakage when register a chip Andy Shevchenko
2022-09-20 14:08 ` Bartosz Golaszewski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox