Patchwork [3.5.y.z,extended,stable] Patch "hwmon: (sht15) Fix memory leak if regulator_enable() fails" has been added to staging queue

login
register
mail settings
Submitter Luis Henriques
Date March 19, 2013, 12:22 p.m.
Message ID <1363695768-8176-1-git-send-email-luis.henriques@canonical.com>
Download mbox | patch
Permalink /patch/229036/
State New
Headers show

Comments

Luis Henriques - March 19, 2013, 12:22 p.m.
This is a note to let you know that I have just added a patch titled

    hwmon: (sht15) Fix memory leak if regulator_enable() fails

to the linux-3.5.y-queue branch of the 3.5.y.z extended stable tree 
which can be found at:

 http://kernel.ubuntu.com/git?p=ubuntu/linux.git;a=shortlog;h=refs/heads/linux-3.5.y-queue

If you, or anyone else, feels it should not be added to this tree, please 
reply to this email.

For more information about the 3.5.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From f037c45c1c8fee076d625218b0c4a18a389bc67e Mon Sep 17 00:00:00 2001
From: Ben Hutchings <ben@decadent.org.uk>
Date: Sat, 16 Mar 2013 06:32:16 -0700
Subject: [PATCH] hwmon: (sht15) Fix memory leak if regulator_enable() fails

Commit 3e78080f8148 ('hwmon: (sht15) Check return value of
regulator_enable()') depends on the use of devm_kmalloc() for automatic
resource cleanup in the failure cases, which was introduced in 3.7.  In
older stable branches, explicit cleanup is needed.

Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/hwmon/sht15.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--
1.8.1.2

Patch

diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c
index eb01802..c689630 100644
--- a/drivers/hwmon/sht15.c
+++ b/drivers/hwmon/sht15.c
@@ -930,7 +930,7 @@  static int __devinit sht15_probe(struct platform_device *pdev)
 		if (ret != 0) {
 			dev_err(&pdev->dev,
 				"failed to enable regulator: %d\n", ret);
-			return ret;
+			goto err_free_data;
 		}

 		/*