All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
@ 2025-08-09 14:32 Mykola Kvach
  2025-08-09 17:15 ` dmkhn
  2025-08-11  7:53 ` Jan Beulich
  0 siblings, 2 replies; 4+ messages in thread
From: Mykola Kvach @ 2025-08-09 14:32 UTC (permalink / raw)
  To: xen-devel
  Cc: Mykola Kvach, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Michal Orzel, Volodymyr Babchuk

From: Mykola Kvach <mykola_kvach@epam.com>

If init_one_irq_desc() fails, init_local_irq_data() returns without
releasing local_irqs_type_lock, leading to a possible deadlock.

Release the lock before returning to ensure proper cleanup.

Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
---
 xen/arch/arm/irq.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index 4bbf0b0664..02ca82c089 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -94,7 +94,10 @@ static int init_local_irq_data(unsigned int cpu)
         int rc = init_one_irq_desc(desc);
 
         if ( rc )
+        {
+            spin_unlock(&local_irqs_type_lock);
             return rc;
+        }
 
         desc->irq = irq;
         desc->action  = NULL;
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
  2025-08-09 14:32 [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path Mykola Kvach
@ 2025-08-09 17:15 ` dmkhn
  2025-08-11  7:53 ` Jan Beulich
  1 sibling, 0 replies; 4+ messages in thread
From: dmkhn @ 2025-08-09 17:15 UTC (permalink / raw)
  To: Mykola Kvach
  Cc: xen-devel, Mykola Kvach, Stefano Stabellini, Julien Grall,
	Bertrand Marquis, Michal Orzel, Volodymyr Babchuk

On Sat, Aug 09, 2025 at 05:32:41PM +0300, Mykola Kvach wrote:
> From: Mykola Kvach <mykola_kvach@epam.com>
> 
> If init_one_irq_desc() fails, init_local_irq_data() returns without
> releasing local_irqs_type_lock, leading to a possible deadlock.
> 
> Release the lock before returning to ensure proper cleanup.
> 
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>

Nice catch!

Please consider:

Reviewed-by: Denis Mukhin <dmukhin@ford.com> 

> ---
>  xen/arch/arm/irq.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
> index 4bbf0b0664..02ca82c089 100644
> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -94,7 +94,10 @@ static int init_local_irq_data(unsigned int cpu)
>          int rc = init_one_irq_desc(desc);
> 
>          if ( rc )
> +        {
> +            spin_unlock(&local_irqs_type_lock);
>              return rc;
> +        }
> 
>          desc->irq = irq;
>          desc->action  = NULL;
> --
> 2.48.1
> 
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
  2025-08-09 14:32 [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path Mykola Kvach
  2025-08-09 17:15 ` dmkhn
@ 2025-08-11  7:53 ` Jan Beulich
  2025-08-11  8:48   ` Mykola Kvach
  1 sibling, 1 reply; 4+ messages in thread
From: Jan Beulich @ 2025-08-11  7:53 UTC (permalink / raw)
  To: Mykola Kvach
  Cc: Mykola Kvach, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Michal Orzel, Volodymyr Babchuk, xen-devel

On 09.08.2025 16:32, Mykola Kvach wrote:
> From: Mykola Kvach <mykola_kvach@epam.com>
> 
> If init_one_irq_desc() fails, init_local_irq_data() returns without
> releasing local_irqs_type_lock, leading to a possible deadlock.
> 
> Release the lock before returning to ensure proper cleanup.
> 
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>

Pretty likely wants backporting, which would best be indicated by a suitable
Fixes: tag.

Jan

> --- a/xen/arch/arm/irq.c
> +++ b/xen/arch/arm/irq.c
> @@ -94,7 +94,10 @@ static int init_local_irq_data(unsigned int cpu)
>          int rc = init_one_irq_desc(desc);
>  
>          if ( rc )
> +        {
> +            spin_unlock(&local_irqs_type_lock);
>              return rc;
> +        }
>  
>          desc->irq = irq;
>          desc->action  = NULL;



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
  2025-08-11  7:53 ` Jan Beulich
@ 2025-08-11  8:48   ` Mykola Kvach
  0 siblings, 0 replies; 4+ messages in thread
From: Mykola Kvach @ 2025-08-11  8:48 UTC (permalink / raw)
  To: Jan Beulich
  Cc: Mykola Kvach, Stefano Stabellini, Julien Grall, Bertrand Marquis,
	Michal Orzel, Volodymyr Babchuk, xen-devel

On Mon, Aug 11, 2025 at 10:53 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 09.08.2025 16:32, Mykola Kvach wrote:
> > From: Mykola Kvach <mykola_kvach@epam.com>
> >
> > If init_one_irq_desc() fails, init_local_irq_data() returns without
> > releasing local_irqs_type_lock, leading to a possible deadlock.
> >
> > Release the lock before returning to ensure proper cleanup.
> >
> > Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
>
> Pretty likely wants backporting, which would best be indicated by a suitable
> Fixes: tag.

I have added the Fixes: tag as suggested and resent the patch.
Thank you for pointing this out.

>
> Jan
>
> > --- a/xen/arch/arm/irq.c
> > +++ b/xen/arch/arm/irq.c
> > @@ -94,7 +94,10 @@ static int init_local_irq_data(unsigned int cpu)
> >          int rc = init_one_irq_desc(desc);
> >
> >          if ( rc )
> > +        {
> > +            spin_unlock(&local_irqs_type_lock);
> >              return rc;
> > +        }
> >
> >          desc->irq = irq;
> >          desc->action  = NULL;
>

Best regards,
Mykola


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-08-11  8:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-09 14:32 [PATCH] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path Mykola Kvach
2025-08-09 17:15 ` dmkhn
2025-08-11  7:53 ` Jan Beulich
2025-08-11  8:48   ` Mykola Kvach

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.