From: Christoph Hellwig Date: Mon, 14 Jan 2019 20:14:08 +0000 (+0100) Subject: swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit X-Git-Tag: v5.0-rc3~33^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=227a76b64718888c1687cc237463aa000ae6fb2b;p=thirdparty%2Flinux.git swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit 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: 55897af63091 ("dma-direct: merge swiotlb_dma_ops into the dma_direct code") Reported-by: Sibren Vasse Signed-off-by: Christoph Hellwig Tested-by: Sibren Vasse Signed-off-by: Konrad Rzeszutek Wilk --- diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index d6361776dc5ce..1fb6fd68b9c7e 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c @@ -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; }