]> git.baikalelectronics.ru Git - kernel.git/commitdiff
swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit
authorChristoph Hellwig <hch@lst.de>
Mon, 14 Jan 2019 20:14:08 +0000 (21:14 +0100)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Wed, 16 Jan 2019 14:59:17 +0000 (09:59 -0500)
Otherwise is_swiotlb_buffer will return false positives when
we first initialize a swiotlb buffer, but then free it because
we have an IOMMU available.

Fixes: e090aad6eb58 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code")
Reported-by: Sibren Vasse <sibren@sibrenvasse.nl>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Tested-by: Sibren Vasse <sibren@sibrenvasse.nl>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
kernel/dma/swiotlb.c

index d6361776dc5cea40ac830fb6e3940d986dd13841..1fb6fd68b9c7e80c969072642a4064f4e9608008 100644 (file)
@@ -378,6 +378,8 @@ void __init swiotlb_exit(void)
                memblock_free_late(io_tlb_start,
                                   PAGE_ALIGN(io_tlb_nslabs << IO_TLB_SHIFT));
        }
+       io_tlb_start = 0;
+       io_tlb_end = 0;
        io_tlb_nslabs = 0;
        max_segment = 0;
 }