summaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-10-21 22:05:38 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-29 16:20:28 -0700
commit4bff7208f332b2b1d7cf1338e50527441283a198 (patch)
tree76e3cfbd5ac1e042a9c2b5f54d33d7c9a5ac8238 /drivers/misc
parent9ae113ce5faf1c74af1ee71b5ef7d04b6b06b063 (diff)
downloadblackbird-op-linux-4bff7208f332b2b1d7cf1338e50527441283a198.tar.gz
blackbird-op-linux-4bff7208f332b2b1d7cf1338e50527441283a198.zip
mei: nfc: fix memory leak in error path
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: <stable@vger.kernel.org> # 3.10+ 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>
Diffstat (limited to 'drivers/misc')
-rw-r--r--drivers/misc/mei/nfc.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/misc/mei/nfc.c b/drivers/misc/mei/nfc.c
index d0c6907dfd92..994ca4aff1a3 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);
OpenPOWER on IntegriCloud