mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-08 14:23:19 +00:00
NFC: Fix missing mutex unlock in pn533_send_cmd_frame_async
If command allocation failed cmd_lock was not released and deadlock would occur. Signed-off-by: Szymon Janc <szymon.janc@tieto.com> Signed-off-by: Samuel Ortiz <sameo@linux.intel.com>
This commit is contained in:
parent
fe235b58d5
commit
ee5e8d812c
@ -716,7 +716,7 @@ static int pn533_send_cmd_frame_async(struct pn533 *dev,
|
|||||||
void *arg, gfp_t flags)
|
void *arg, gfp_t flags)
|
||||||
{
|
{
|
||||||
struct pn533_cmd *cmd;
|
struct pn533_cmd *cmd;
|
||||||
int rc;
|
int rc = 0;
|
||||||
|
|
||||||
nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
|
nfc_dev_dbg(&dev->interface->dev, "%s", __func__);
|
||||||
|
|
||||||
@ -729,16 +729,16 @@ static int pn533_send_cmd_frame_async(struct pn533 *dev,
|
|||||||
if (!rc)
|
if (!rc)
|
||||||
dev->cmd_pending = 1;
|
dev->cmd_pending = 1;
|
||||||
|
|
||||||
mutex_unlock(&dev->cmd_lock);
|
goto unlock;
|
||||||
|
|
||||||
return rc;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
nfc_dev_dbg(&dev->interface->dev, "%s Queueing command", __func__);
|
nfc_dev_dbg(&dev->interface->dev, "%s Queueing command", __func__);
|
||||||
|
|
||||||
cmd = kzalloc(sizeof(struct pn533_cmd), flags);
|
cmd = kzalloc(sizeof(struct pn533_cmd), flags);
|
||||||
if (!cmd)
|
if (!cmd) {
|
||||||
return -ENOMEM;
|
rc = -ENOMEM;
|
||||||
|
goto unlock;
|
||||||
|
}
|
||||||
|
|
||||||
INIT_LIST_HEAD(&cmd->queue);
|
INIT_LIST_HEAD(&cmd->queue);
|
||||||
cmd->out_frame = out_frame;
|
cmd->out_frame = out_frame;
|
||||||
@ -750,9 +750,10 @@ static int pn533_send_cmd_frame_async(struct pn533 *dev,
|
|||||||
|
|
||||||
list_add_tail(&cmd->queue, &dev->cmd_queue);
|
list_add_tail(&cmd->queue, &dev->cmd_queue);
|
||||||
|
|
||||||
|
unlock:
|
||||||
mutex_unlock(&dev->cmd_lock);
|
mutex_unlock(&dev->cmd_lock);
|
||||||
|
|
||||||
return 0;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pn533_sync_cmd_response {
|
struct pn533_sync_cmd_response {
|
||||||
|
Loading…
Reference in New Issue
Block a user