mirror of https://github.com/torvalds/linux.git
ASoC: SDCA: Correct FDL locking in sdca_fdl_process()
The current locking in sdca_fdl_process() locks over
sdca_ump_cancel_timeout() and the timeout work function takes the same
lock, this can lead to a deadlock if the work runs as part of the
cancel. To fix this use scoped_guard and move the cancel timeout to be
outside the lock.
Fixes: e92e25f777 ("ASoC: SDCA: Add UMP timeout handling for FDL")
Tested-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Maciej Strozek <mstrozek@opensource.cirrus.com>
Reviewed-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Tested-by: Richard Fitzgerald <rf@opensource.cirrus.com>
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Link: https://patch.msgid.link/20251120153023.2105663-5-ckeepax@opensource.cirrus.com
Reviewed-by: Vinod Koul <vkoul@kernel.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
5fe65824b7
commit
cc58055bfe
|
|
@ -402,8 +402,6 @@ int sdca_fdl_process(struct sdca_interrupt *interrupt)
|
|||
unsigned int reg, status;
|
||||
int response, ret;
|
||||
|
||||
guard(mutex)(&fdl_state->lock);
|
||||
|
||||
ret = sdca_ump_get_owner_host(dev, interrupt->function_regmap,
|
||||
interrupt->function, interrupt->entity,
|
||||
interrupt->control);
|
||||
|
|
@ -412,8 +410,9 @@ int sdca_fdl_process(struct sdca_interrupt *interrupt)
|
|||
|
||||
sdca_ump_cancel_timeout(&fdl_state->timeout);
|
||||
|
||||
reg = SDW_SDCA_CTL(interrupt->function->desc->adr, interrupt->entity->id,
|
||||
SDCA_CTL_XU_FDL_STATUS, 0);
|
||||
scoped_guard(mutex, &fdl_state->lock) {
|
||||
reg = SDW_SDCA_CTL(interrupt->function->desc->adr,
|
||||
interrupt->entity->id, SDCA_CTL_XU_FDL_STATUS, 0);
|
||||
ret = regmap_read(interrupt->function_regmap, reg, &status);
|
||||
if (ret < 0) {
|
||||
dev_err(dev, "failed to read FDL status: %d\n", ret);
|
||||
|
|
@ -438,7 +437,8 @@ int sdca_fdl_process(struct sdca_interrupt *interrupt)
|
|||
}
|
||||
|
||||
ret = sdca_ump_set_owner_device(dev, interrupt->function_regmap,
|
||||
interrupt->function, interrupt->entity,
|
||||
interrupt->function,
|
||||
interrupt->entity,
|
||||
interrupt->control);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
|
@ -463,6 +463,7 @@ int sdca_fdl_process(struct sdca_interrupt *interrupt)
|
|||
sdca_ump_schedule_timeout(&fdl_state->timeout, xu->max_delay);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
reset_function:
|
||||
sdca_reset_function(dev, interrupt->function, interrupt->function_regmap);
|
||||
|
|
|
|||
Loading…
Reference in New Issue