Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8b551ea6 authored by Janosch Frank's avatar Janosch Frank Committed by android-build-merger
Browse files

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

am: 9d89c20f

Change-Id: I3a3b215e0e9254f87ccb05ee17a2bc7881fdd272
parents 06e68c07 9d89c20f
Loading
Loading
Loading
Loading
+18 −1
Original line number Original line Diff line number Diff line
@@ -606,12 +606,29 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
bool test_and_clear_guest_dirty(struct mm_struct *mm, unsigned long addr)
{
{
	spinlock_t *ptl;
	spinlock_t *ptl;
	pgd_t *pgd;
	pud_t *pud;
	pmd_t *pmd;
	pgste_t pgste;
	pgste_t pgste;
	pte_t *ptep;
	pte_t *ptep;
	pte_t pte;
	pte_t pte;
	bool dirty;
	bool dirty;


	ptep = get_locked_pte(mm, addr, &ptl);
	pgd = pgd_offset(mm, addr);
	pud = pud_alloc(mm, pgd, addr);
	if (!pud)
		return false;
	pmd = pmd_alloc(mm, pud, addr);
	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;

	ptep = pte_alloc_map_lock(mm, pmd, addr, &ptl);
	if (unlikely(!ptep))
	if (unlikely(!ptep))
		return false;
		return false;