Return-Path: Content-Type: text/plain; charset="UTF-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 From: Ben Hutchings To: linux-kernel@vger.kernel.org, stable@vger.kernel.org CC: akpm@linux-foundation.org, "Johan Hovold" , "Linus Walleij" Date: Tue, 03 Mar 2015 22:11:28 +0000 Message-ID: Subject: [PATCH 3.2 10/24] gpio: sysfs: fix memory leak in gpiod_export_link In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: 3.2.68-rc1 review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit 0f303db08df0df9bd0966443ad6001e63960af16 upstream. 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") Signed-off-by: Johan Hovold Signed-off-by: Linus Walleij [bwh: Backported to 3.2: adjust filename] Signed-off-by: Ben Hutchings --- drivers/gpio/gpiolib.c | 1 + 1 file changed, 1 insertion(+) --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -821,6 +821,7 @@ int gpio_export_link(struct device *dev, if (tdev != NULL) { status = sysfs_create_link(&dev->kobj, &tdev->kobj, name); + put_device(tdev); } else { status = -ENODEV; }