]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/4.19.32/irqchip-gic-v3-its-fix-comparison-logic-in-lpi_range_cmp.patch
Linux 4.19.32
[thirdparty/kernel/stable-queue.git] / releases / 4.19.32 / irqchip-gic-v3-its-fix-comparison-logic-in-lpi_range_cmp.patch
CommitLineData
891d6185
GKH
1From 89dc891792c2e046b030f87600109c22209da32e Mon Sep 17 00:00:00 2001
2From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
3Date: Tue, 12 Mar 2019 18:33:46 +0100
4Subject: irqchip/gic-v3-its: Fix comparison logic in lpi_range_cmp
5
6From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
7
8commit 89dc891792c2e046b030f87600109c22209da32e upstream.
9
10The lpi_range_list is supposed to be sorted in ascending order of
11->base_id (at least if the range merging is to work), but the current
12comparison function returns a positive value if rb->base_id >
13ra->base_id, which means that list_sort() will put A after B in that
14case - and vice versa, of course.
15
16Fixes: 880cb3cddd16 (irqchip/gic-v3-its: Refactor LPI allocator)
17Cc: stable@vger.kernel.org (v4.19+)
18Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
19Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
20Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
21
22---
23 drivers/irqchip/irq-gic-v3-its.c | 2 +-
24 1 file changed, 1 insertion(+), 1 deletion(-)
25
26--- a/drivers/irqchip/irq-gic-v3-its.c
27+++ b/drivers/irqchip/irq-gic-v3-its.c
28@@ -1477,7 +1477,7 @@ static int lpi_range_cmp(void *priv, str
29 ra = container_of(a, struct lpi_range, entry);
30 rb = container_of(b, struct lpi_range, entry);
31
32- return rb->base_id - ra->base_id;
33+ return ra->base_id - rb->base_id;
34 }
35
36 static void merge_lpi_ranges(void)