Patch "irqchip/qcom-pdc: Fix broken locking" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    irqchip/qcom-pdc: Fix broken locking

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     irqchip-qcom-pdc-fix-broken-locking.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 0fe9e2a3211b2afaa26ce196eecd72536241a2ae
Author: Marc Zyngier <maz@xxxxxxxxxx>
Date:   Thu Feb 24 10:12:25 2022 +0000

    irqchip/qcom-pdc: Fix broken locking
    
    [ Upstream commit a6aca2f460e203781dc41391913cc5b54f4bc0ce ]
    
    pdc_enable_intr() serves as a primitive to qcom_pdc_gic_{en,dis}able,
    and has a raw spinlock for mutual exclusion, which is uses with
    interruptible primitives.
    
    This means that this critical section can itself be interrupted.
    Should the interrupt also be a PDC interrupt, and the endpoint driver
    perform an irq_disable() on that interrupt, we end-up in a deadlock.
    
    Fix this by using the irqsave/irqrestore variants of the locking
    primitives.
    
    Signed-off-by: Marc Zyngier <maz@xxxxxxxxxx>
    Reviewed-by: Maulik Shah <quic_mkshah@xxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220224101226.88373-5-maz@xxxxxxxxxx
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/irqchip/qcom-pdc.c b/drivers/irqchip/qcom-pdc.c
index 173e6520e06e..c0b457f26ec4 100644
--- a/drivers/irqchip/qcom-pdc.c
+++ b/drivers/irqchip/qcom-pdc.c
@@ -56,17 +56,18 @@ static u32 pdc_reg_read(int reg, u32 i)
 static void pdc_enable_intr(struct irq_data *d, bool on)
 {
 	int pin_out = d->hwirq;
+	unsigned long flags;
 	u32 index, mask;
 	u32 enable;
 
 	index = pin_out / 32;
 	mask = pin_out % 32;
 
-	raw_spin_lock(&pdc_lock);
+	raw_spin_lock_irqsave(&pdc_lock, flags);
 	enable = pdc_reg_read(IRQ_ENABLE_BANK, index);
 	enable = on ? ENABLE_INTR(enable, mask) : CLEAR_INTR(enable, mask);
 	pdc_reg_write(IRQ_ENABLE_BANK, index, enable);
-	raw_spin_unlock(&pdc_lock);
+	raw_spin_unlock_irqrestore(&pdc_lock, flags);
 }
 
 static void qcom_pdc_gic_disable(struct irq_data *d)



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux