]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.5/irqchip-gic-v3-its-fix-comparison-logic-in-lpi_range_cmp.patch
Linux 4.19.32
[thirdparty/kernel/stable-queue.git] / releases / 5.0.5 / irqchip-gic-v3-its-fix-comparison-logic-in-lpi_range_cmp.patch
1 From 89dc891792c2e046b030f87600109c22209da32e Mon Sep 17 00:00:00 2001
2 From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
3 Date: Tue, 12 Mar 2019 18:33:46 +0100
4 Subject: irqchip/gic-v3-its: Fix comparison logic in lpi_range_cmp
5
6 From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
7
8 commit 89dc891792c2e046b030f87600109c22209da32e upstream.
9
10 The 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
12 comparison function returns a positive value if rb->base_id >
13 ra->base_id, which means that list_sort() will put A after B in that
14 case - and vice versa, of course.
15
16 Fixes: 880cb3cddd16 (irqchip/gic-v3-its: Refactor LPI allocator)
17 Cc: stable@vger.kernel.org (v4.19+)
18 Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
19 Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
20 Signed-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 @@ -1482,7 +1482,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)