kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sheng Yang <sheng@linux.intel.com>
To: Jan Kiszka <jan.kiszka@web.de>
Cc: kvm <kvm@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Crash in intel_iommu_assign_device
Date: Tue, 2 Nov 2010 14:52:19 +0800	[thread overview]
Message-ID: <201011021452.19525.sheng@linux.intel.com> (raw)
In-Reply-To: <4CCEA761.90501@web.de>

On Monday 01 November 2010 19:41:21 Jan Kiszka wrote:
> Hi Sheng,
> 
> I'm not claiming to understand the details, but this looks like use
> (dereference of pte via dma_pte_addr) after release (free_pgtable_page
> of dmar_domain->pgd aka pte) to me:
> 
> static int intel_iommu_attach_device(struct iommu_domain *domain,
> 				     struct device *dev)
> {
> 	[...]
> 		pte = dmar_domain->pgd;
> 		if (dma_pte_present(pte)) {
> 			free_pgtable_page(dmar_domain->pgd);
> 			dmar_domain->pgd = (struct dma_pte *)
> 				phys_to_virt(dma_pte_addr(pte));
> 		}
> 
> At least it crashes here right on pte->val access. Swap both lines?

I think code is right.

The comment above indicate the case: the code want to decrease the level of page 
table. Mostly it is a 4 level page table, and the code would turn it into 3 levels 
pagetable. What the code did is just get the first entry of the old pagetable level 
4, then free the level 4 pagetable's page, and make the pagetable to a level 3 
pagetable.

Seems it make no sense to swap the lines...

--
regards
Yang, Sheng

> 
> Jan

  reply	other threads:[~2010-11-02  6:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-01 11:41 Crash in intel_iommu_assign_device Jan Kiszka
2010-11-02  6:52 ` Sheng Yang [this message]
2010-11-02  7:07   ` Jan Kiszka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201011021452.19525.sheng@linux.intel.com \
    --to=sheng@linux.intel.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).