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" <przemyslaw.hawrylewicz.czarnowski@intel.com>
Signed-off-by: NeilBrown <neilb@suse.de>
This commit is contained in:
NeilBrown 2010-11-22 19:35:25 +11:00
parent 1e2b276535
commit 37194990aa
1 changed files with 2 additions and 2 deletions

View File

@ -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;