aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2013-10-21 15:05:38 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-10-29 19:20:28 -0400
commit4bff7208f332b2b1d7cf1338e50527441283a198 (patch)
tree76e3cfbd5ac1e042a9c2b5f54d33d7c9a5ac8238 /drivers/misc
parent9ae113ce5faf1c74af1ee71b5ef7d04b6b06b063 (diff)
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)
485 if (ndev->cl_info) 485 if (ndev->cl_info)
486 return 0; 486 return 0;
487 487
488 cl_info = mei_cl_allocate(dev); 488 ndev->cl_info = mei_cl_allocate(dev);
489 cl = mei_cl_allocate(dev); 489 ndev->cl = mei_cl_allocate(dev);
490
491 cl = ndev->cl;
492 cl_info = ndev->cl_info;
490 493
491 if (!cl || !cl_info) { 494 if (!cl || !cl_info) {
492 ret = -ENOMEM; 495 ret = -ENOMEM;
@@ -527,10 +530,9 @@ int mei_nfc_host_init(struct mei_device *dev)
527 530
528 cl->device_uuid = mei_nfc_guid; 531 cl->device_uuid = mei_nfc_guid;
529 532
533
530 list_add_tail(&cl->device_link, &dev->device_list); 534 list_add_tail(&cl->device_link, &dev->device_list);
531 535
532 ndev->cl_info = cl_info;
533 ndev->cl = cl;
534 ndev->req_id = 1; 536 ndev->req_id = 1;
535 537
536 INIT_WORK(&ndev->init_work, mei_nfc_init); 538 INIT_WORK(&ndev->init_work, mei_nfc_init);