]> 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:44:20 +0000 (09:44 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 15 Jul 2021 07:44:20 +0000 (09:44 +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 94285db1b440dcb70df09ac6f3fe262883d2535e..235895403900a31a23d936d5d46624aa1e3d8250 100644 (file)
@@ -556,7 +556,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);