intel-iommu: Check for identity mapping candidate using system dma mask
commit001a5287ce15ac855136d9912ba3a71e40befa0a
authorChris Wright <chrisw@sous-sol.org>
Sat, 28 May 2011 18:15:02 +0000 (28 13:15 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 23 Jun 2011 22:05:31 +0000 (23 15:05 -0700)
tree4f983ef907c321206402fcbe5634fcecae316a35
parent26265892ce15ab6637959631b03d25528f817e76
intel-iommu: Check for identity mapping candidate using system dma mask

commit 8fcc5372fbac085199d84a880503ed67aba3fe49 upstream.

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>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/pci/intel-iommu.c