[v3] bus/fslmc: unlock spinlock in case of timeout
Checks
Commit Message
Bug in function mc_send_command,
A spinlock is not unlocked in case of timeouts.
Fixes: 79711846f676 ("bus/fslmc: add timeout in MC send command")
Cc: stable@dpdk.org
Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
Reviewed-by: David Marchand <david.marchand@redhat.com>
--
v2:
- Fix code indentation.
- Fix "Fixes: " tag format.
v3:
- Remove unnecessary comment.
- cc stable@dpdk.org
---
drivers/bus/fslmc/mc/mc_sys.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
Comments
On Wed, Jan 4, 2023 at 8:41 AM Alvaro Karsz <alvaro.karsz@solid-run.com> wrote:
>
> Bug in function mc_send_command,
> A spinlock is not unlocked in case of timeouts.
>
> Fixes: 79711846f676 ("bus/fslmc: add timeout in MC send command")
> Cc: stable@dpdk.org
>
> Signed-off-by: Alvaro Karsz <alvaro.karsz@solid-run.com>
> Reviewed-by: David Marchand <david.marchand@redhat.com>
No review from the driver maintainers after a month.
The fix seems valid to me.
Applied, thanks.
@@ -77,8 +77,11 @@ int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
total_time = rte_get_timer_cycles() - start_time;
} while (status == MC_CMD_STATUS_READY && total_time <= time_to_wait);
- if (status == MC_CMD_STATUS_READY)
+ if (status == MC_CMD_STATUS_READY) {
+ rte_spinlock_unlock(&mc_portal_lock);
+
return mc_status_to_error(MC_CMD_STATUS_TIMEOUT);
+ }
/* Read the response back into the command buffer */
mc_read_response(mc_io->regs, cmd);