* [PATCH 1/2] ASoc: qcom: q6afe: fix bad guard conversion
2025-12-03 10:55 [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Johan Hovold
@ 2025-12-03 10:55 ` Johan Hovold
2025-12-03 14:11 ` Srinivas Kandagatla
2025-12-03 10:55 ` [PATCH 2/2] ASoc: qcom: q6afe: use guards consistently Johan Hovold
` (2 subsequent siblings)
3 siblings, 1 reply; 6+ messages in thread
From: Johan Hovold @ 2025-12-03 10:55 UTC (permalink / raw)
To: Srinivas Kandagatla, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-kernel, Johan Hovold, Srinivas Kandagatla
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 <srinivas.kandagatla@oss.qualcomm.com>
Signed-off-by: Johan Hovold <johan@kernel.org>
---
sound/soc/qcom/qdsp6/q6afe.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 980851a12976..0b01fc9e13a7 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -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;
--
2.51.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: [PATCH 1/2] ASoc: qcom: q6afe: fix bad guard conversion
2025-12-03 10:55 ` [PATCH 1/2] " Johan Hovold
@ 2025-12-03 14:11 ` Srinivas Kandagatla
0 siblings, 0 replies; 6+ messages in thread
From: Srinivas Kandagatla @ 2025-12-03 14:11 UTC (permalink / raw)
To: Johan Hovold, Srinivas Kandagatla, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-kernel
On 12/3/25 10:55 AM, Johan Hovold wrote:
> 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 <srinivas.kandagatla@oss.qualcomm.com>
> Signed-off-by: Johan Hovold <johan@kernel.org>
> ---
Thanks Johan, That is true, I missed the irqsave variant .
Reviewed-by: Srinivas Kandagatla <srinivas.kandagatla@oss.qualcomm.com>
--srini> sound/soc/qcom/qdsp6/q6afe.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
> index 980851a12976..0b01fc9e13a7 100644
> --- a/sound/soc/qcom/qdsp6/q6afe.c
> +++ b/sound/soc/qcom/qdsp6/q6afe.c
> @@ -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;
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/2] ASoc: qcom: q6afe: use guards consistently
2025-12-03 10:55 [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Johan Hovold
2025-12-03 10:55 ` [PATCH 1/2] " Johan Hovold
@ 2025-12-03 10:55 ` Johan Hovold
2025-12-04 13:04 ` (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Mark Brown
2025-12-15 13:58 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Johan Hovold @ 2025-12-03 10:55 UTC (permalink / raw)
To: Srinivas Kandagatla, Mark Brown
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-kernel, Johan Hovold
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.
Signed-off-by: Johan Hovold <johan@kernel.org>
---
sound/soc/qcom/qdsp6/q6afe.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)
diff --git a/sound/soc/qcom/qdsp6/q6afe.c b/sound/soc/qcom/qdsp6/q6afe.c
index 0b01fc9e13a7..d8173cd9e60a 100644
--- a/sound/soc/qcom/qdsp6/q6afe.c
+++ b/sound/soc/qcom/qdsp6/q6afe.c
@@ -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;
--
2.51.2
^ permalink raw reply related [flat|nested] 6+ messages in thread* Re: (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion
2025-12-03 10:55 [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Johan Hovold
2025-12-03 10:55 ` [PATCH 1/2] " Johan Hovold
2025-12-03 10:55 ` [PATCH 2/2] ASoc: qcom: q6afe: use guards consistently Johan Hovold
@ 2025-12-04 13:04 ` Mark Brown
2025-12-15 13:58 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-12-04 13:04 UTC (permalink / raw)
To: Srinivas Kandagatla, Johan Hovold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-kernel
On Wed, 03 Dec 2025 11:55:40 +0100, Johan Hovold wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion
2025-12-03 10:55 [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Johan Hovold
` (2 preceding siblings ...)
2025-12-04 13:04 ` (subset) [PATCH 0/2] ASoc: qcom: q6afe: fix bad guard conversion Mark Brown
@ 2025-12-15 13:58 ` Mark Brown
3 siblings, 0 replies; 6+ messages in thread
From: Mark Brown @ 2025-12-15 13:58 UTC (permalink / raw)
To: Srinivas Kandagatla, Johan Hovold
Cc: Liam Girdwood, Jaroslav Kysela, Takashi Iwai, linux-sound,
linux-kernel
On Wed, 03 Dec 2025 11:55:40 +0100, Johan Hovold wrote:
> 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
^ permalink raw reply [flat|nested] 6+ messages in thread