ASoc: qcom: q6afe: fix bad guard conversion
Subsystems (3)
PATCH 1/2 ASoc: qcom: q6afe: fix bad guard conversion
In reply to Johan HovoldA recent spinlock guard conversion used the wrong guard so that interrupts are no longer disabled while holding the port list lock.
Based on a cursory look this appears to be safe currently, but it could cause a deadlock if one of these helpers are ever called in interrupt context.
--- sound/soc/qcom/qdsp6/q6afe.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/qcom/qdsp6/q6afe.c +2 -2
@@ -947,7 +947,7 @@ static struct q6afe_port *q6afe_find_port(struct q6afe *afe, int token)struct q6afe_port *p;struct q6afe_port *ret =NULL ; -guard (spinlock)(&afe->port_list_lock); +guard (spinlock_irqsave)(&afe->port_list_lock);list_for_each_entry (p, &afe->port_list, node)if (p->token == token) { ret = p;
@@ -1807,7 +1807,7 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) port->cfg_type = cfg_type;kref_init (&port->refcount); -guard (spinlock)(&afe->port_list_lock); +guard (spinlock_irqsave)(&afe->port_list_lock);list_add_tail (&port->node, &afe->port_list);return port;
Signature · 1 line
2.51.2
cover ASoc: qcom: q6afe: fix bad guard conversion
This series fixes a bad guard conversion in one of the Qualcomm drivers.
Included is also a related cleanup.
Johan
Johan Hovold (2):
ASoc: qcom: q6afe: fix bad guard conversion
ASoc: qcom: q6afe: use guards consistently
sound/soc/qcom/qdsp6/q6afe.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-)
Signature · 1 line
2.51.2
PATCH 2/2 ASoc: qcom: q6afe: use guards consistently
A recent change switched to using guards for the port list lock but only modified two out of three functions where the lock is held.
Convert also the third function for consistency while switching to a scoped guard in q6afe_port_get_from_id() for clarity.
--- sound/soc/qcom/qdsp6/q6afe.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-)
sound/soc/qcom/qdsp6/q6afe.c +4 -6
@@ -931,13 +931,11 @@ static void q6afe_port_free(struct kref *ref) {struct q6afe_port *port;struct q6afe *afe; -unsigned long flags; port = container_of(ref, struct q6afe_port, refcount); afe = port->afe; -spin_lock_irqsave (&afe->port_list_lock, flags); -list_del (&port->node); -spin_unlock_irqrestore (&afe->port_list_lock, flags); + scoped_guard(spinlock_irqsave, &afe->port_list_lock) +list_del (&port->node);kfree (port->scfg);kfree (port); }
@@ -1807,8 +1805,8 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) port->cfg_type = cfg_type;kref_init (&port->refcount); -guard (spinlock_irqsave)(&afe->port_list_lock); -list_add_tail (&port->node, &afe->port_list); + scoped_guard(spinlock_irqsave, &afe->port_list_lock) +list_add_tail (&port->node, &afe->port_list);return port;
Signature · 1 line
2.51.2
Quoted 11 lines · Johan Hovold
A recent spinlock guard conversion used the wrong guard so that interrupts are no longer disabled while holding the port list lock.
Based on a cursory look this appears to be safe currently, but it could cause a deadlock if one of these helpers are ever called in interrupt context.
Fixes 4b1edbb028fb ("ASoC: qcom: q6afe: Use guard() for spin locks")Cc Srinivas Kandagatla <[email protected]>Signed-off-by Johan Hovold <[email protected]>---
Thanks Johan, That is true, I missed the irqsave variant .
--srini> sound/soc/qcom/qdsp6/q6afe.c | 4 ++--
Quoted 24 lines
1 file changed, 2 insertions(+), 2 deletions(-)sound/soc/qcom/qdsp6/q6afe.c +2
-2@@ -947,7 +947,7 @@ static struct q6afe_port *q6afe_find_port(struct q6afe *afe, int token)struct q6afe_port *p;struct q6afe_port *ret =NULL ; -guard (spinlock)(&afe->port_list_lock); +guard (spinlock_irqsave)(&afe->port_list_lock);list_for_each_entry (p, &afe->port_list, node)if (p->token == token) { ret = p;@@ -1807,7 +1807,7 @@ struct q6afe_port *q6afe_port_get_from_id(struct device *dev, int id) port->cfg_type = cfg_type;kref_init (&port->refcount); -guard (spinlock)(&afe->port_list_lock); +guard (spinlock_irqsave)(&afe->port_list_lock);list_add_tail (&port->node, &afe->port_list);return port;
Mark Brown
maintainerRe: (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion
In reply to Johan HovoldQuoted 8 lines · Johan Hovold
This series fixes a bad guard conversion in one of the Qualcomm drivers.
Included is also a related cleanup.
Johan
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[1/2] ASoc: qcom: q6afe: fix bad guard conversion
commit: 39191ce5dbfd65fededb4f0d408d6232c45766ba
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark
Mark Brown
maintainerRe: (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion
In reply to Johan HovoldQuoted 8 lines · Johan Hovold
This series fixes a bad guard conversion in one of the Qualcomm drivers.
Included is also a related cleanup.
Johan
[...]
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next
Thanks!
[2/2] ASoc: qcom: q6afe: use guards consistently
commit: dfbbd3c04f0f782e83f8677749e2f02359ffd1b5
All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying to this mail.
Thanks,
Mark