stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* FAILED: patch "[PATCH] gpio: mockup: fix resource leak in error path" failed to apply to 4.14-stable tree
@ 2020-10-04 10:37 gregkh
  2020-11-19 20:58 ` Sudip Mukherjee
  0 siblings, 1 reply; 3+ messages in thread
From: gregkh @ 2020-10-04 10:37 UTC (permalink / raw)
  To: bgolaszewski, andriy.shevchenko, stable; +Cc: stable


The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@vger.kernel.org>.

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

From 1b02d9e770cd7087f34c743f85ccf5ea8372b047 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date: Tue, 8 Sep 2020 15:07:49 +0200
Subject: [PATCH] gpio: mockup: fix resource leak in error path

If the module init function fails after creating the debugs directory,
it's never removed. Add proper cleanup calls to avoid this resource
leak.

Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index bc345185db26..1652897fdf90 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -552,6 +552,7 @@ static int __init gpio_mockup_init(void)
 	err = platform_driver_register(&gpio_mockup_driver);
 	if (err) {
 		gpio_mockup_err("error registering platform driver\n");
+		debugfs_remove_recursive(gpio_mockup_dbg_dir);
 		return err;
 	}
 
@@ -582,6 +583,7 @@ static int __init gpio_mockup_init(void)
 			gpio_mockup_err("error registering device");
 			platform_driver_unregister(&gpio_mockup_driver);
 			gpio_mockup_unregister_pdevs();
+			debugfs_remove_recursive(gpio_mockup_dbg_dir);
 			return PTR_ERR(pdev);
 		}
 


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

* Re: FAILED: patch "[PATCH] gpio: mockup: fix resource leak in error path" failed to apply to 4.14-stable tree
  2020-10-04 10:37 FAILED: patch "[PATCH] gpio: mockup: fix resource leak in error path" failed to apply to 4.14-stable tree gregkh
@ 2020-11-19 20:58 ` Sudip Mukherjee
  2020-11-20  8:56   ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Sudip Mukherjee @ 2020-11-19 20:58 UTC (permalink / raw)
  To: gregkh; +Cc: bgolaszewski, andriy.shevchenko, stable

[-- Attachment #1: Type: text/plain, Size: 401 bytes --]

Hi Greg,

On Sun, Oct 04, 2020 at 12:37:11PM +0200, gregkh@linuxfoundation.org wrote:
> 
> The patch below does not apply to the 4.14-stable tree.
> If someone wants it applied there, or to any other stable or longterm
> tree, then please email the backport, including the original git commit
> id to <stable@vger.kernel.org>.

Here is the backport. Please consider for 4.14-stable.

--
Regards
Sudip

[-- Attachment #2: 0001-gpio-mockup-fix-resource-leak-in-error-path.patch --]
[-- Type: text/x-diff, Size: 1243 bytes --]

From 9c0dde685fd7e37a444a927fb9c9aca740444816 Mon Sep 17 00:00:00 2001
From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Date: Tue, 8 Sep 2020 15:07:49 +0200
Subject: [PATCH] gpio: mockup: fix resource leak in error path

commit 1b02d9e770cd7087f34c743f85ccf5ea8372b047 upstream

If the module init function fails after creating the debugs directory,
it's never removed. Add proper cleanup calls to avoid this resource
leak.

Fixes: 9202ba2397d1 ("gpio: mockup: implement event injecting over debugfs")
Cc: <stable@vger.kernel.org>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
[sudip: adjust context]
Signed-off-by: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
---
 drivers/gpio/gpio-mockup.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpio-mockup.c b/drivers/gpio/gpio-mockup.c
index d99c8d8da9a0..a09a1334afbf 100644
--- a/drivers/gpio/gpio-mockup.c
+++ b/drivers/gpio/gpio-mockup.c
@@ -350,6 +350,7 @@ static int __init mock_device_init(void)
 	err = platform_driver_register(&gpio_mockup_driver);
 	if (err) {
 		platform_device_unregister(pdev);
+		debugfs_remove_recursive(gpio_mockup_dbg_dir);
 		return err;
 	}
 
-- 
2.11.0


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

* Re: FAILED: patch "[PATCH] gpio: mockup: fix resource leak in error path" failed to apply to 4.14-stable tree
  2020-11-19 20:58 ` Sudip Mukherjee
@ 2020-11-20  8:56   ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2020-11-20  8:56 UTC (permalink / raw)
  To: Sudip Mukherjee; +Cc: bgolaszewski, andriy.shevchenko, stable

On Thu, Nov 19, 2020 at 08:58:39PM +0000, Sudip Mukherjee wrote:
> Hi Greg,
> 
> On Sun, Oct 04, 2020 at 12:37:11PM +0200, gregkh@linuxfoundation.org wrote:
> > 
> > The patch below does not apply to the 4.14-stable tree.
> > If someone wants it applied there, or to any other stable or longterm
> > tree, then please email the backport, including the original git commit
> > id to <stable@vger.kernel.org>.
> 
> Here is the backport. Please consider for 4.14-stable.

Now queued up, thanks.

greg k-h

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

end of thread, other threads:[~2020-11-20  8:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-04 10:37 FAILED: patch "[PATCH] gpio: mockup: fix resource leak in error path" failed to apply to 4.14-stable tree gregkh
2020-11-19 20:58 ` Sudip Mukherjee
2020-11-20  8:56   ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).