Commit 9537a48ed4b9e4b738943d6da0a0fd4278adf905
Committed by
Ingo Molnar
1 parent
35d40952db
Exists in
master
and in
4 other branches
dma-debug: make memory range checks more consistent
Impact: extend on-kernel-stack DMA debug checks to all !highmem pages We only checked dma_map_single() - extend it to dma_map_page() and dma_map_sg() as well. Also, fix dma_map_single() corner case bug: make sure we dont stack-check highmem (not mapped) pages. Reported-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> Signed-off-by: Joerg Roedel <joerg.roedel@amd.com> Cc: iommu@lists.linux-foundation.org LKML-Reference: <1237818908-26516-1-git-send-email-joerg.roedel@amd.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Showing 1 changed file with 8 additions and 5 deletions Side-by-side Diff
lib/dma-debug.c
... | ... | @@ -722,10 +722,11 @@ |
722 | 722 | entry->size = size; |
723 | 723 | entry->direction = direction; |
724 | 724 | |
725 | - if (map_single) { | |
726 | - void *addr = ((char *)page_address(page)) + offset; | |
727 | - | |
725 | + if (map_single) | |
728 | 726 | entry->type = dma_debug_single; |
727 | + | |
728 | + if (!PageHighMem(page)) { | |
729 | + void *addr = ((char *)page_address(page)) + offset; | |
729 | 730 | check_for_stack(dev, addr); |
730 | 731 | check_for_illegal_area(dev, addr, size); |
731 | 732 | } |
... | ... | @@ -779,8 +780,10 @@ |
779 | 780 | entry->sg_call_ents = nents; |
780 | 781 | entry->sg_mapped_ents = mapped_ents; |
781 | 782 | |
782 | - check_for_stack(dev, sg_virt(s)); | |
783 | - check_for_illegal_area(dev, sg_virt(s), s->length); | |
783 | + if (!PageHighMem(sg_page(s))) { | |
784 | + check_for_stack(dev, sg_virt(s)); | |
785 | + check_for_illegal_area(dev, sg_virt(s), s->length); | |
786 | + } | |
784 | 787 | |
785 | 788 | add_dma_entry(entry); |
786 | 789 | } |