Skip to content

Commit

Permalink
x86/mem-sharing: ensure consistent lock order in get_two_gfns()
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Tamas K Lengyel <[email protected]>
  • Loading branch information
jbeulich committed Jul 7, 2021
1 parent 980d6ac commit 09af2d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion xen/include/asm-x86/p2m.h
Original file line number Diff line number Diff line change
Expand Up @@ -587,7 +587,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);
Expand Down

0 comments on commit 09af2d0

Please sign in to comment.