aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2012-10-11 08:04:00 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-11-19 18:09:26 -0500
commit70418e6efcf4f8652cc08e3f2ab8ae35f0948fd9 (patch)
tree68f02c2d54409ab028336ed6acb2922297f188ac /drivers/nfc
parent770f750bc2b8312489c8e45306f551d08a319d3c (diff)
NFC: pn533: Fix mem leak in pn533_in_dep_link_up
cmd is allocated in pn533_dep_link_up and passed as an arg to pn533_send_cmd_frame_async together with a complete cb. arg is passed to the cb and must be kfreed there. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 84a2e77ab5de..807bbb8e82d9 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -1679,11 +1679,14 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
1679static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, 1679static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1680 u8 *params, int params_len) 1680 u8 *params, int params_len)
1681{ 1681{
1682 struct pn533_cmd_jump_dep *cmd;
1683 struct pn533_cmd_jump_dep_response *resp; 1682 struct pn533_cmd_jump_dep_response *resp;
1684 struct nfc_target nfc_target; 1683 struct nfc_target nfc_target;
1685 u8 target_gt_len; 1684 u8 target_gt_len;
1686 int rc; 1685 int rc;
1686 struct pn533_cmd_jump_dep *cmd = (struct pn533_cmd_jump_dep *)arg;
1687 u8 active = cmd->active;
1688
1689 kfree(arg);
1687 1690
1688 if (params_len == -ENOENT) { 1691 if (params_len == -ENOENT) {
1689 nfc_dev_dbg(&dev->interface->dev, ""); 1692 nfc_dev_dbg(&dev->interface->dev, "");
@@ -1705,7 +1708,6 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1705 } 1708 }
1706 1709
1707 resp = (struct pn533_cmd_jump_dep_response *) params; 1710 resp = (struct pn533_cmd_jump_dep_response *) params;
1708 cmd = (struct pn533_cmd_jump_dep *) arg;
1709 rc = resp->status & PN533_CMD_RET_MASK; 1711 rc = resp->status & PN533_CMD_RET_MASK;
1710 if (rc != PN533_CMD_RET_SUCCESS) { 1712 if (rc != PN533_CMD_RET_SUCCESS) {
1711 nfc_dev_err(&dev->interface->dev, 1713 nfc_dev_err(&dev->interface->dev,
@@ -1735,7 +1737,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
1735 if (rc == 0) 1737 if (rc == 0)
1736 rc = nfc_dep_link_is_up(dev->nfc_dev, 1738 rc = nfc_dep_link_is_up(dev->nfc_dev,
1737 dev->nfc_dev->targets[0].idx, 1739 dev->nfc_dev->targets[0].idx,
1738 !cmd->active, NFC_RF_INITIATOR); 1740 !active, NFC_RF_INITIATOR);
1739 1741
1740 return 0; 1742 return 0;
1741} 1743}