Commit 26ae2049 authored by Gustaw Lewandowski's avatar Gustaw Lewandowski Committed by Mark Brown

ASoC: Intel: Fix race condition in IPC rx list

Since there are multiple IPCs being sent in a short span of time, there
is a possibility of more than one message being on the Rx list after
receiving response from firmware. In such cases, when the first
notification of interrupt from firmware is received, driver retrieves
the message from the Rx list but does not delete it from the list till
the next lock. In the meantime, when another interrupt is received from
the firmware, driver is reading the previous message again since the
previous message has not been removed from the list.
Signed-off-by: default avatarGustaw Lewandowski <gustaw.lewandowski@intel.com>
Reviewed-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 07875939
...@@ -344,6 +344,7 @@ static struct ipc_message *skl_ipc_reply_get_msg(struct sst_generic_ipc *ipc, ...@@ -344,6 +344,7 @@ static struct ipc_message *skl_ipc_reply_get_msg(struct sst_generic_ipc *ipc,
msg = list_first_entry(&ipc->rx_list, struct ipc_message, list); msg = list_first_entry(&ipc->rx_list, struct ipc_message, list);
list_del(&msg->list);
out: out:
return msg; return msg;
...@@ -488,7 +489,6 @@ void skl_ipc_process_reply(struct sst_generic_ipc *ipc, ...@@ -488,7 +489,6 @@ void skl_ipc_process_reply(struct sst_generic_ipc *ipc,
} }
spin_lock_irqsave(&ipc->dsp->spinlock, flags); spin_lock_irqsave(&ipc->dsp->spinlock, flags);
list_del(&msg->list);
sst_ipc_tx_msg_reply_complete(ipc, msg); sst_ipc_tx_msg_reply_complete(ipc, msg);
spin_unlock_irqrestore(&ipc->dsp->spinlock, flags); spin_unlock_irqrestore(&ipc->dsp->spinlock, flags);
} }
......
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