mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Marc Zyngier <marc.zyngier@arm.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Jason Cooper <jason@lakedaemon.net>
Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	stable@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/4] irqchip/gic-v3-its: fix comparison logic in lpi_range_cmp
Date: Tue, 12 Mar 2019 18:33:46 +0100	[thread overview]
Message-ID: <20190312173350.4025-2-linux@rasmusvillemoes.dk> (raw)
In-Reply-To: <20190312173350.4025-1-linux@rasmusvillemoes.dk>

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>
---
 drivers/irqchip/irq-gic-v3-its.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/irqchip/irq-gic-v3-its.c b/drivers/irqchip/irq-gic-v3-its.c
index 2dd1ff0cf558..7577755bdcf4 100644
--- a/drivers/irqchip/irq-gic-v3-its.c
+++ b/drivers/irqchip/irq-gic-v3-its.c
@@ -1482,7 +1482,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)
-- 
2.20.1


  reply	other threads:[~2019-03-12 17:34 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 17:33 [PATCH 0/4] irqchip/gic-v3-its: free_lpi_range tweaks Rasmus Villemoes
2019-03-12 17:33 ` Rasmus Villemoes [this message]
2019-03-12 17:33 ` [PATCH 2/4] irqchip/gic-v3-its: move allocation outside mutex Rasmus Villemoes
2019-03-12 17:33 ` [PATCH 3/4] irqchip/gic-v3-its: drop redundant initialization in mk_lpi_range Rasmus Villemoes
2019-03-12 17:33 ` [PATCH 4/4] irqchip/gic-v3-its: make free_lpi_range a little cheaper Rasmus Villemoes
2019-03-12 18:03 ` [PATCH 0/4] irqchip/gic-v3-its: free_lpi_range tweaks Marc Zyngier

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190312173350.4025-2-linux@rasmusvillemoes.dk \
    --to=linux@rasmusvillemoes.dk \
    --cc=jason@lakedaemon.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®