linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] gpio: sysfs: fix memory leaks
@ 2015-01-26 11:02 Johan Hovold
  2015-01-26 11:02 ` [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link Johan Hovold
  2015-01-26 11:02 ` [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low Johan Hovold
  0 siblings, 2 replies; 5+ messages in thread
From: Johan Hovold @ 2015-01-26 11:02 UTC (permalink / raw)
  To: Linus Walleij; +Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold

Here are two more fixes for long-standing memory leaks in the gpio sysfs
interface (for v3.19).

Johan


Johan Hovold (2):
  gpio: sysfs: fix memory leak in gpiod_export_link
  gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low

 drivers/gpio/gpiolib-sysfs.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

-- 
2.0.5


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

* [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link
  2015-01-26 11:02 [PATCH 0/2] gpio: sysfs: fix memory leaks Johan Hovold
@ 2015-01-26 11:02 ` Johan Hovold
  2015-01-30  9:29   ` Linus Walleij
  2015-01-26 11:02 ` [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low Johan Hovold
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2015-01-26 11:02 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold, stable

Fix memory leak in the gpio sysfs interface due to failure to drop
reference to device returned by class_find_device when creating a link.

Fixes: a4177ee7f1a8 ("gpiolib: allow exported GPIO nodes to be named
using sysfs links")
Cc: stable <stable@vger.kernel.org>	# v2.6.32
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpio/gpiolib-sysfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 14c4f94813eb..820b1e70ddfe 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -648,6 +648,7 @@ int gpiod_export_link(struct device *dev, const char *name,
 		if (tdev != NULL) {
 			status = sysfs_create_link(&dev->kobj, &tdev->kobj,
 						name);
+			put_device(tdev);
 		} else {
 			status = -ENODEV;
 		}
-- 
2.0.5


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

* [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low
  2015-01-26 11:02 [PATCH 0/2] gpio: sysfs: fix memory leaks Johan Hovold
  2015-01-26 11:02 ` [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link Johan Hovold
@ 2015-01-26 11:02 ` Johan Hovold
  2015-01-30  9:30   ` Linus Walleij
  1 sibling, 1 reply; 5+ messages in thread
From: Johan Hovold @ 2015-01-26 11:02 UTC (permalink / raw)
  To: Linus Walleij
  Cc: Alexandre Courbot, linux-gpio, linux-kernel, Johan Hovold, stable

Fix memory leak in the gpio sysfs interface due to failure to drop
reference to device returned by class_find_device when setting the
gpio-line polarity.

Fixes: 0769746183ca ("gpiolib: add support for changing value polarity
in sysfs")
Cc: stable <stable@vger.kernel.org>	# v2.6.33
Signed-off-by: Johan Hovold <johan@kernel.org>
---
 drivers/gpio/gpiolib-sysfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-sysfs.c b/drivers/gpio/gpiolib-sysfs.c
index 820b1e70ddfe..4908d09873e5 100644
--- a/drivers/gpio/gpiolib-sysfs.c
+++ b/drivers/gpio/gpiolib-sysfs.c
@@ -696,7 +696,7 @@ int gpiod_sysfs_set_active_low(struct gpio_desc *desc, int value)
 	}
 
 	status = sysfs_set_active_low(desc, dev, value);
-
+	put_device(dev);
 unlock:
 	mutex_unlock(&sysfs_lock);
 
-- 
2.0.5


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

* Re: [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link
  2015-01-26 11:02 ` [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link Johan Hovold
@ 2015-01-30  9:29   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-01-30  9:29 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Alexandre Courbot, linux-gpio, linux-kernel, stable

On Mon, Jan 26, 2015 at 12:02 PM, Johan Hovold <johan@kernel.org> wrote:

> Fix memory leak in the gpio sysfs interface due to failure to drop
> reference to device returned by class_find_device when creating a link.
>
> Fixes: a4177ee7f1a8 ("gpiolib: allow exported GPIO nodes to be named
> using sysfs links")
> Cc: stable <stable@vger.kernel.org>     # v2.6.32
> Signed-off-by: Johan Hovold <johan@kernel.org>

Patch applied.

Let's see if I get it into v3.19 properly...

Yours,
Linus Walleij

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

* Re: [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low
  2015-01-26 11:02 ` [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low Johan Hovold
@ 2015-01-30  9:30   ` Linus Walleij
  0 siblings, 0 replies; 5+ messages in thread
From: Linus Walleij @ 2015-01-30  9:30 UTC (permalink / raw)
  To: Johan Hovold; +Cc: Alexandre Courbot, linux-gpio, linux-kernel, stable

On Mon, Jan 26, 2015 at 12:02 PM, Johan Hovold <johan@kernel.org> wrote:

> Fix memory leak in the gpio sysfs interface due to failure to drop
> reference to device returned by class_find_device when setting the
> gpio-line polarity.
>
> Fixes: 0769746183ca ("gpiolib: add support for changing value polarity
> in sysfs")
> Cc: stable <stable@vger.kernel.org>     # v2.6.33
> Signed-off-by: Johan Hovold <johan@kernel.org>

Patch applied.

Yours,
Linus Walleij

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

end of thread, other threads:[~2015-01-30  9:30 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 11:02 [PATCH 0/2] gpio: sysfs: fix memory leaks Johan Hovold
2015-01-26 11:02 ` [PATCH 1/2] gpio: sysfs: fix memory leak in gpiod_export_link Johan Hovold
2015-01-30  9:29   ` Linus Walleij
2015-01-26 11:02 ` [PATCH 2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low Johan Hovold
2015-01-30  9:30   ` Linus Walleij

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).