Commit 70418e6e authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Samuel Ortiz

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: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent 770f750b
...@@ -1679,11 +1679,14 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev, ...@@ -1679,11 +1679,14 @@ static void pn533_deactivate_target(struct nfc_dev *nfc_dev,
static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
u8 *params, int params_len) u8 *params, int params_len)
{ {
struct pn533_cmd_jump_dep *cmd;
struct pn533_cmd_jump_dep_response *resp; struct pn533_cmd_jump_dep_response *resp;
struct nfc_target nfc_target; struct nfc_target nfc_target;
u8 target_gt_len; u8 target_gt_len;
int rc; int rc;
struct pn533_cmd_jump_dep *cmd = (struct pn533_cmd_jump_dep *)arg;
u8 active = cmd->active;
kfree(arg);
if (params_len == -ENOENT) { if (params_len == -ENOENT) {
nfc_dev_dbg(&dev->interface->dev, ""); nfc_dev_dbg(&dev->interface->dev, "");
...@@ -1705,7 +1708,6 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, ...@@ -1705,7 +1708,6 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
} }
resp = (struct pn533_cmd_jump_dep_response *) params; resp = (struct pn533_cmd_jump_dep_response *) params;
cmd = (struct pn533_cmd_jump_dep *) arg;
rc = resp->status & PN533_CMD_RET_MASK; rc = resp->status & PN533_CMD_RET_MASK;
if (rc != PN533_CMD_RET_SUCCESS) { if (rc != PN533_CMD_RET_SUCCESS) {
nfc_dev_err(&dev->interface->dev, nfc_dev_err(&dev->interface->dev,
...@@ -1735,7 +1737,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg, ...@@ -1735,7 +1737,7 @@ static int pn533_in_dep_link_up_complete(struct pn533 *dev, void *arg,
if (rc == 0) if (rc == 0)
rc = nfc_dep_link_is_up(dev->nfc_dev, rc = nfc_dep_link_is_up(dev->nfc_dev,
dev->nfc_dev->targets[0].idx, dev->nfc_dev->targets[0].idx,
!cmd->active, NFC_RF_INITIATOR); !active, NFC_RF_INITIATOR);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment