irqchip/gic-v3-its: Fix comparison logic in lpi_range_cmp
authorRasmus Villemoes <linux@rasmusvillemoes.dk>
Tue, 12 Mar 2019 17:33:46 +0000 (18:33 +0100)
committerMarc Zyngier <marc.zyngier@arm.com>
Wed, 20 Mar 2019 18:20:39 +0000 (18:20 +0000)
The lpi_range_list is supposed to be sorted in ascending order of
->base_id (at least if the range merging is to work), but the current
comparison function returns a positive value if rb->base_id >
ra->base_id, which means that list_sort() will put A after B in that
case - and vice versa, of course.

Fixes: 880cb3cddd16 (irqchip/gic-v3-its: Refactor LPI allocator)
Cc: stable@vger.kernel.org (v4.19+)
Signed-off-by: Rasmus Villemoes <linux@rasmusvillemoes.dk>
Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
drivers/irqchip/irq-gic-v3-its.c

index fb7157188294ecafcddf126f176092bf811e5fb2..783810716015df8e3fe67cd1b01be06af0893fb3 100644 (file)
@@ -1476,7 +1476,7 @@ static int lpi_range_cmp(void *priv, struct list_head *a, struct list_head *b)
        ra = container_of(a, struct lpi_range, entry);
        rb = container_of(b, struct lpi_range, entry);
 
-       return rb->base_id - ra->base_id;
+       return ra->base_id - rb->base_id;
 }
 
 static void merge_lpi_ranges(void)