Commit 0ce1fbdd authored by Waldemar Rymarkiewicz's avatar Waldemar Rymarkiewicz Committed by Samuel Ortiz

NFC: pn533: Fix memleak while scheduling next cmd

In case of error from __pn533_send_frame_async() while sending
next cmd from the queue (cmd_wq), cmd->req, cmd->resp and
cmd->arg pointers won't be freed.
Signed-off-by: default avatarWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>
Signed-off-by: default avatarSamuel Ortiz <sameo@linux.intel.com>
parent f75c2913
...@@ -886,6 +886,7 @@ static void pn533_wq_cmd(struct work_struct *work) ...@@ -886,6 +886,7 @@ static void pn533_wq_cmd(struct work_struct *work)
{ {
struct pn533 *dev = container_of(work, struct pn533, cmd_work); struct pn533 *dev = container_of(work, struct pn533, cmd_work);
struct pn533_cmd *cmd; struct pn533_cmd *cmd;
int rc;
mutex_lock(&dev->cmd_lock); mutex_lock(&dev->cmd_lock);
...@@ -901,8 +902,13 @@ static void pn533_wq_cmd(struct work_struct *work) ...@@ -901,8 +902,13 @@ static void pn533_wq_cmd(struct work_struct *work)
mutex_unlock(&dev->cmd_lock); mutex_unlock(&dev->cmd_lock);
__pn533_send_frame_async(dev, cmd->req, cmd->resp, cmd->resp_len, rc = __pn533_send_frame_async(dev, cmd->req, cmd->resp, cmd->resp_len,
pn533_send_async_complete, cmd->arg); pn533_send_async_complete, cmd->arg);
if (rc < 0) {
dev_kfree_skb(cmd->req);
dev_kfree_skb(cmd->resp);
kfree(cmd->arg);
}
kfree(cmd); kfree(cmd);
} }
......
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