]> xenbits.xensource.com Git - xen.git/commitdiff
x86/mem-sharing: ensure consistent lock order in get_two_gfns()
authorJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:34:28 +0000 (09:34 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:34:28 +0000 (09:34 +0200)
While the comment validly says "Sort by domain, if same domain by gfn",
the implementation also included equal domain IDs in the first part of
the check, thus rending the second part entirely dead and leaving
deadlock potential when there's only a single domain involved.

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Tamas K Lengyel <tamas@tklengyel.com>
master commit: 09af2d01a2fe6a0af08598bdfe12c9707f4d82ba
master date: 2021-07-07 12:35:12 +0200

xen/include/asm-x86/p2m.h

index 8abae345e854e0808538bfa94781c67cfcb1e309..2883d8a2f08e474b597b82d9e5a030fbc4c4dbf7 100644 (file)
@@ -552,7 +552,7 @@ do {                                                    \
     dest ## _t   = (source ## t)   ?: &scratch_t;       \
 } while (0)
 
-    if ( (rd->domain_id <= ld->domain_id) ||
+    if ( (rd->domain_id < ld->domain_id) ||
          ((rd == ld) && (gfn_x(rgfn) <= gfn_x(lgfn))) )
     {
         assign_pointers(first, r);