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
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;
© 2016 - 2025 Red Hat, Inc.