From 3e9331338b5a03cc4ceb35aaa839e3f93dbb0be4 Mon Sep 17 00:00:00 2001 From: Marc Zyngier Date: Wed, 20 Feb 2019 20:36:49 +0800 Subject: [PATCH] irqchip/gic-v3-its: Gracefully fail on LPI exhaustion mainline inclusion from mainline-5.0 commit 45725e0fc3e7 category: bugfix bugzilla: 9453 CVE: NA ------------------------------------------------- In the unlikely event that we cannot find any available LPI in the system, we should gracefully return an error instead of carrying on with no LPI allocated at all. Fixes: 38dd7c494cf6 ("irqchip/gic-v3-its: Drop chunk allocation compatibility") Signed-off-by: Marc Zyngier Signed-off-by: Bixuan Cui Reviewed-by: Hanjun Guo Signed-off-by: Yang Yingliang --- drivers/irqchip/irq-gic-v3-its.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c index f76e52100f36..7d99616c295a 100644 --- a/drivers/irqchip/irq-gic-v3-its.c +++ b/drivers/irqchip/irq-gic-v3-its.c @@ -1586,6 +1586,9 @@ static unsigned long *its_lpi_alloc(int nr_irqs, u32 *base, int *nr_ids) nr_irqs /= 2; } while (nr_irqs > 0); + if (!nr_irqs) + err = -ENOSPC; + if (err) goto out; -- GitLab