aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/nfc
diff options
context:
space:
mode:
authorSzymon Janc <szymon.janc@tieto.com>2012-10-25 11:29:45 -0400
committerSamuel Ortiz <sameo@linux.intel.com>2012-11-19 18:09:25 -0500
commit60ad07ab6bc86f48b6ebda1788d79ca5f88d824c (patch)
tree5a2947353b130138c3258cc135d596414aed667a /drivers/nfc
parent16a78e9fed5e8baa8480ae3413f4328c4537c599 (diff)
NFC: pn533: Fix missing lock while operating on commands list
In pn533_wq_cmd command was removed from list without cmd_lock held (race with pn533_send_cmd_frame_async) which could lead to list corruption. Delete command from list before releasing lock. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
Diffstat (limited to 'drivers/nfc')
-rw-r--r--drivers/nfc/pn533.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/nfc/pn533.c b/drivers/nfc/pn533.c
index 97c440a8cd61..328f2b66491e 100644
--- a/drivers/nfc/pn533.c
+++ b/drivers/nfc/pn533.c
@@ -698,13 +698,14 @@ static void pn533_wq_cmd(struct work_struct *work)
698 698
699 cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue); 699 cmd = list_first_entry(&dev->cmd_queue, struct pn533_cmd, queue);
700 700
701 list_del(&cmd->queue);
702
701 mutex_unlock(&dev->cmd_lock); 703 mutex_unlock(&dev->cmd_lock);
702 704
703 __pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame, 705 __pn533_send_cmd_frame_async(dev, cmd->out_frame, cmd->in_frame,
704 cmd->in_frame_len, cmd->cmd_complete, 706 cmd->in_frame_len, cmd->cmd_complete,
705 cmd->arg, cmd->flags); 707 cmd->arg, cmd->flags);
706 708
707 list_del(&cmd->queue);
708 kfree(cmd); 709 kfree(cmd);
709} 710}
710 711