intel-iommu: Check for identity mapping candidate using system dma mask
authorChris Wright <chrisw@sous-sol.org>
Sat, 28 May 2011 18:15:02 +0000 (13:15 -0500)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Wed, 1 Jun 2011 11:47:34 +0000 (12:47 +0100)
commit8fcc5372fbac085199d84a880503ed67aba3fe49
treeaab84e5ac18fa8028efa49e2cc47a5b97d873916
parent9b4554b21ed07e8556405510638171f0c787742a
intel-iommu: Check for identity mapping candidate using system dma mask

The identity mapping code appears to make the assumption that if the
devices dma_mask is greater than 32bits the device can use identity
mapping.  But that is not true: take the case where we have a 40bit
device in a 44bit architecture. The device can potentially receive a
physical address that it will truncate and cause incorrect addresses
to be used.

Instead check to see if the device's dma_mask is large enough
to address the system's dma_mask.

Signed-off-by: Mike Travis <travis@sgi.com>
Reviewed-by: Mike Habeck <habeck@sgi.com>
Cc: stable@kernel.org
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
drivers/pci/intel-iommu.c