x86: fix pci-gart failure handling
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Fri, 26 Oct 2007 11:56:24 +0000 (13:56 +0200)
committerJens Axboe <jens.axboe@oracle.com>
Mon, 29 Oct 2007 08:18:03 +0000 (09:18 +0100)
blk_rq_map_sg doesn't initialize sg->dma_address/length to zero
anymore. Some low level drivers reuse sg lists without initializing so
IOMMUs might get non-zero dma_address/length. If map_sg fails, we need
pass the number of the mapped entries to gart_unmap_sg.

Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: Jens Axboe <jens.axboe@oracle.com>
arch/x86/kernel/pci-gart_64.c

index ae7e0161ce46e9e1eacbca8c2cb24a5a599456b9..79b514b381b1476acd8559f18e6c0019b0c19910 100644 (file)
@@ -435,7 +435,7 @@ static int gart_map_sg(struct device *dev, struct scatterlist *sg, int nents,
 
 error:
        flush_gart();
-       gart_unmap_sg(dev, sg, nents, dir);
+       gart_unmap_sg(dev, sg, out, dir);
        /* When it was forced or merged try again in a dumb way */
        if (force_iommu || iommu_merge) {
                out = dma_map_sg_nonforce(dev, sg, nents, dir);