Skip to content

Commit dabfc87

Browse files
Marc Zyngiergregkh
authored andcommitted
irqchip/qcom-pdc: Fix broken locking
[ Upstream commit a6aca2f ] 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@kernel.org> Reviewed-by: Maulik Shah <quic_mkshah@quicinc.com> Link: https://lore.kernel.org/r/20220224101226.88373-5-maz@kernel.org Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 05ba7d0 commit dabfc87

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

drivers/irqchip/qcom-pdc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,17 +56,18 @@ static u32 pdc_reg_read(int reg, u32 i)
5656
static void pdc_enable_intr(struct irq_data *d, bool on)
5757
{
5858
int pin_out = d->hwirq;
59+
unsigned long flags;
5960
u32 index, mask;
6061
u32 enable;
6162

6263
index = pin_out / 32;
6364
mask = pin_out % 32;
6465

65-
raw_spin_lock(&pdc_lock);
66+
raw_spin_lock_irqsave(&pdc_lock, flags);
6667
enable = pdc_reg_read(IRQ_ENABLE_BANK, index);
6768
enable = on ? ENABLE_INTR(enable, mask) : CLEAR_INTR(enable, mask);
6869
pdc_reg_write(IRQ_ENABLE_BANK, index, enable);
69-
raw_spin_unlock(&pdc_lock);
70+
raw_spin_unlock_irqrestore(&pdc_lock, flags);
7071
}
7172

7273
static void qcom_pdc_gic_disable(struct irq_data *d)

0 commit comments

Comments
 (0)