KVM: s390: Fix guest migration for huge guests resulting in panic

am: b0e85701a7

Change-Id: I12bd03d14c3bf2c1e5d2c70e1765eba1d6d202b9
This commit is contained in:
Janosch Frank
2017-03-18 11:24:32 +00:00
committed by android-build-merger

View File

@@ -1237,11 +1237,28 @@ EXPORT_SYMBOL_GPL(s390_reset_cmma);
*/
bool gmap_test_and_clear_dirty(unsigned long address, struct gmap *gmap)
{
pgd_t *pgd;
pud_t *pud;
pmd_t *pmd;
pte_t *pte;
spinlock_t *ptl;
bool dirty = false;
pte = get_locked_pte(gmap->mm, address, &ptl);
pgd = pgd_offset(gmap->mm, address);
pud = pud_alloc(gmap->mm, pgd, address);
if (!pud)
return false;
pmd = pmd_alloc(gmap->mm, pud, address);
if (!pmd)
return false;
/* We can't run guests backed by huge pages, but userspace can
* still set them up and then try to migrate them without any
* migration support.
*/
if (pmd_large(*pmd))
return true;
pte = pte_alloc_map_lock(gmap->mm, pmd, address, &ptl);
if (unlikely(!pte))
return false;