diff options
| -rw-r--r-- | arch/x86/xen/p2m.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index d1b3da2960ab..b456b048eca9 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c | |||
| @@ -532,12 +532,13 @@ static bool alloc_p2m(unsigned long pfn) | |||
| 532 | unsigned topidx, mididx; | 532 | unsigned topidx, mididx; |
| 533 | unsigned long ***top_p, **mid; | 533 | unsigned long ***top_p, **mid; |
| 534 | unsigned long *top_mfn_p, *mid_mfn; | 534 | unsigned long *top_mfn_p, *mid_mfn; |
| 535 | unsigned long *p2m_orig; | ||
| 535 | 536 | ||
| 536 | topidx = p2m_top_index(pfn); | 537 | topidx = p2m_top_index(pfn); |
| 537 | mididx = p2m_mid_index(pfn); | 538 | mididx = p2m_mid_index(pfn); |
| 538 | 539 | ||
| 539 | top_p = &p2m_top[topidx]; | 540 | top_p = &p2m_top[topidx]; |
| 540 | mid = *top_p; | 541 | mid = ACCESS_ONCE(*top_p); |
| 541 | 542 | ||
| 542 | if (mid == p2m_mid_missing) { | 543 | if (mid == p2m_mid_missing) { |
| 543 | /* Mid level is missing, allocate a new one */ | 544 | /* Mid level is missing, allocate a new one */ |
| @@ -552,7 +553,7 @@ static bool alloc_p2m(unsigned long pfn) | |||
| 552 | } | 553 | } |
| 553 | 554 | ||
| 554 | top_mfn_p = &p2m_top_mfn[topidx]; | 555 | top_mfn_p = &p2m_top_mfn[topidx]; |
| 555 | mid_mfn = p2m_top_mfn_p[topidx]; | 556 | mid_mfn = ACCESS_ONCE(p2m_top_mfn_p[topidx]); |
| 556 | 557 | ||
| 557 | BUG_ON(virt_to_mfn(mid_mfn) != *top_mfn_p); | 558 | BUG_ON(virt_to_mfn(mid_mfn) != *top_mfn_p); |
| 558 | 559 | ||
| @@ -579,11 +580,10 @@ static bool alloc_p2m(unsigned long pfn) | |||
| 579 | } | 580 | } |
| 580 | } | 581 | } |
| 581 | 582 | ||
| 582 | if (p2m_top[topidx][mididx] == p2m_identity || | 583 | p2m_orig = ACCESS_ONCE(p2m_top[topidx][mididx]); |
| 583 | p2m_top[topidx][mididx] == p2m_missing) { | 584 | if (p2m_orig == p2m_identity || p2m_orig == p2m_missing) { |
| 584 | /* p2m leaf page is missing */ | 585 | /* p2m leaf page is missing */ |
| 585 | unsigned long *p2m; | 586 | unsigned long *p2m; |
| 586 | unsigned long *p2m_orig = p2m_top[topidx][mididx]; | ||
| 587 | 587 | ||
| 588 | p2m = alloc_p2m_page(); | 588 | p2m = alloc_p2m_page(); |
| 589 | if (!p2m) | 589 | if (!p2m) |
