From 37194990aae3dfdbaae55fb9d2ab491683ade7e1 Mon Sep 17 00:00:00 2001 From: NeilBrown Date: Mon, 22 Nov 2010 19:35:25 +1100 Subject: [PATCH] Fix error in pol_sort. pol_sort could go into an infinite loop. The proof of this patch is left as a exercise for the reader :-) Reported-by: "Hawrylewicz Czarnowski, Przemyslaw" Signed-off-by: NeilBrown --- policy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/policy.c b/policy.c index 945d37f..5f18034 100644 --- a/policy.c +++ b/policy.c @@ -137,8 +137,8 @@ static void pol_sort(struct dev_policy **pol) if (p[next] == NULL || (p[1-next] != NULL && !(pol_lesseq(prev, p[1-next]) - ^pol_lesseq(p[1-next], p[next]) - ^pol_lesseq(p[next], prev))) + ^pol_lesseq(prev, p[next]) + ^pol_lesseq(p[next], p[1-next]))) ) next = 1 - next;