diff options
Diffstat (limited to 'kernel/dma/swiotlb.c')
-rw-r--r-- | kernel/dma/swiotlb.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/kernel/dma/swiotlb.c b/kernel/dma/swiotlb.c index 6f7d4e977c5c..8b1360772fc5 100644 --- a/kernel/dma/swiotlb.c +++ b/kernel/dma/swiotlb.c | |||
@@ -587,10 +587,14 @@ found: | |||
587 | */ | 587 | */ |
588 | for (i = 0; i < nslots; i++) | 588 | for (i = 0; i < nslots; i++) |
589 | io_tlb_orig_addr[index+i] = orig_addr + (i << IO_TLB_SHIFT); | 589 | io_tlb_orig_addr[index+i] = orig_addr + (i << IO_TLB_SHIFT); |
590 | if (!(attrs & DMA_ATTR_SKIP_CPU_SYNC) && | 590 | /* |
591 | (dir == DMA_TO_DEVICE || dir == DMA_BIDIRECTIONAL)) | 591 | * When dir == DMA_FROM_DEVICE we could omit the copy from the orig |
592 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_TO_DEVICE); | 592 | * to the tlb buffer, if we knew for sure the device will |
593 | 593 | * overwirte the entire current content. But we don't. Thus | |
594 | * unconditional bounce may prevent leaking swiotlb content (i.e. | ||
595 | * kernel memory) to user-space. | ||
596 | */ | ||
597 | swiotlb_bounce(orig_addr, tlb_addr, size, DMA_TO_DEVICE); | ||
594 | return tlb_addr; | 598 | return tlb_addr; |
595 | } | 599 | } |
596 | 600 | ||