[PATCH v2] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path

Mykola Kvach posted 1 patch 2 months, 2 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://gitlab.com/xen-project/patchew/xen tags/patchew/f983bb7c3c9f0912da7e7f2fc22384ce1081a7a3.1754901835.git.mykola._5Fkvach@epam.com
xen/arch/arm/irq.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH v2] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
Posted by Mykola Kvach 2 months, 2 weeks ago
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.

Fixes: 2bb32b809250 ("xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()")
Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
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
Re: [PATCH v2] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
Posted by Julien Grall 2 months, 2 weeks ago
Hi Mykola,

On 11/08/2025 09:45, 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.
> 
> Fixes: 2bb32b809250 ("xen/irq: Propagate the error from init_one_desc_irq() in init_*_irq_data()")
> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
> Reviewed-by: Denis Mukhin <dmukhin@ford.com>

Acked-by: Julien Grall <jgrall@amazon.com>

I will commit the patch soon.

Cheers,

-- 
Julien Grall
Re: [PATCH v2] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
Posted by Julien Grall 2 months, 2 weeks ago

On 11/08/2025 18:28, Julien Grall wrote:
> Hi Mykola,
> 
> On 11/08/2025 09:45, 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.
>>
>> Fixes: 2bb32b809250 ("xen/irq: Propagate the error from 
>> init_one_desc_irq() in init_*_irq_data()")
>> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
>> Reviewed-by: Denis Mukhin <dmukhin@ford.com>
> 
> Acked-by: Julien Grall <jgrall@amazon.com>
> 
> I will commit the patch soon.

This is now merged.

Cheers,

-- 
Julien Grall
Re: [PATCH v2] xen/arm: irq: add missing spin_unlock() in init_local_irq_data() error path
Posted by Mykola Kvach 2 months, 1 week ago
On Tue, Aug 12, 2025 at 2:07 PM Julien Grall <julien@xen.org> wrote:
>
>
>
> On 11/08/2025 18:28, Julien Grall wrote:
> > Hi Mykola,
> >
> > On 11/08/2025 09:45, 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.
> >>
> >> Fixes: 2bb32b809250 ("xen/irq: Propagate the error from
> >> init_one_desc_irq() in init_*_irq_data()")
> >> Signed-off-by: Mykola Kvach <mykola_kvach@epam.com>
> >> Reviewed-by: Denis Mukhin <dmukhin@ford.com>
> >
> > Acked-by: Julien Grall <jgrall@amazon.com>
> >
> > I will commit the patch soon.
>
> This is now merged.

Thanks everyone for the reviews and merging!

Best regards,
Mykola

>
> Cheers,
>
> --
> Julien Grall
>