diff mbox

[2/2] gpio: sysfs: fix memory leak in gpiod_sysfs_set_active_low

Message ID 1422270166-17525-3-git-send-email-johan@kernel.org
State New
Headers show

Commit Message

Johan Hovold Jan. 26, 2015, 11:02 a.m. UTC
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(-)

Comments

Linus Walleij Jan. 30, 2015, 9:30 a.m. UTC | #1
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
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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