diff mbox

[3.11.y.z,extended,stable] Patch "mei: nfc: fix memory leak in error path" has been added to staging queue

Message ID 1386242771-4368-1-git-send-email-luis.henriques@canonical.com
State New
Headers show

Commit Message

Luis Henriques Dec. 5, 2013, 11:26 a.m. UTC
This is a note to let you know that I have just added a patch titled

    mei: nfc: fix memory leak in error path

to the linux-3.11.y-queue branch of the 3.11.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.11.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.11.y.z tree, see
https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable

Thanks.
-Luis

------

From 99adb9ae343e4e9094405ca358ffd35d0a505b91 Mon Sep 17 00:00:00 2001
From: Tomas Winkler <tomas.winkler@intel.com>
Date: Mon, 21 Oct 2013 22:05:38 +0300
Subject: mei: nfc: fix memory leak in error path

commit 4bff7208f332b2b1d7cf1338e50527441283a198 upstream.

The flow may reach the err label without freeing cl and cl_info

cl and cl_info weren't assigned to ndev->cl and cl_info
so they weren't freed in mei_nfc_free called on error path

Cc: Samuel Ortiz <sameo@linux.intel.com>
Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Luis Henriques <luis.henriques@canonical.com>
---
 drivers/misc/mei/nfc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

--
1.8.3.2
diff mbox

Patch

diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index d0c6907..994ca4a 100644
--- a/drivers/misc/mei/nfc.c
+++ b/drivers/misc/mei/nfc.c
@@ -485,8 +485,11 @@  int mei_nfc_host_init(struct mei_device *dev)
 	if (ndev->cl_info)
 		return 0;

-	cl_info = mei_cl_allocate(dev);
-	cl = mei_cl_allocate(dev);
+	ndev->cl_info = mei_cl_allocate(dev);
+	ndev->cl = mei_cl_allocate(dev);
+
+	cl = ndev->cl;
+	cl_info = ndev->cl_info;

 	if (!cl || !cl_info) {
 		ret = -ENOMEM;
@@ -527,10 +530,9 @@  int mei_nfc_host_init(struct mei_device *dev)

 	cl->device_uuid = mei_nfc_guid;

+
 	list_add_tail(&cl->device_link, &dev->device_list);

-	ndev->cl_info = cl_info;
-	ndev->cl = cl;
 	ndev->req_id = 1;

 	INIT_WORK(&ndev->init_work, mei_nfc_init);