diff options
| author | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-06-14 08:01:30 -0400 |
|---|---|---|
| committer | Marek Szyprowski <m.szyprowski@samsung.com> | 2012-06-14 08:01:30 -0400 |
| commit | c080e26edc3a2a3cdfa4c430c663ee1c3bbd8fae (patch) | |
| tree | 218ba0a4f52a1dbc790af46f5a8bf18afd6372fe | |
| parent | fdb1117325ad719dc39e81209bc622d511db70e0 (diff) | |
x86: dma-mapping: fix broken allocation when dma_mask has been provided
Commit 0a2b9a6ea93 ("X86: integrate CMA with DMA-mapping subsystem")
broke memory allocation with dma_mask. This patch fixes possible kernel
ops caused by lack of resetting page variable when jumping to 'again' label.
Reported-by: Konrad Rzeszutek Wilk <konrad@darnok.org>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Michal Nazarewicz <mina86@mina86.com>
| -rw-r--r-- | arch/x86/kernel/pci-dma.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/arch/x86/kernel/pci-dma.c b/arch/x86/kernel/pci-dma.c index 62c9457ccd2f..c0f420f76cd3 100644 --- a/arch/x86/kernel/pci-dma.c +++ b/arch/x86/kernel/pci-dma.c | |||
| @@ -100,7 +100,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
| 100 | struct dma_attrs *attrs) | 100 | struct dma_attrs *attrs) |
| 101 | { | 101 | { |
| 102 | unsigned long dma_mask; | 102 | unsigned long dma_mask; |
| 103 | struct page *page = NULL; | 103 | struct page *page; |
| 104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; | 104 | unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT; |
| 105 | dma_addr_t addr; | 105 | dma_addr_t addr; |
| 106 | 106 | ||
| @@ -108,6 +108,7 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size, | |||
| 108 | 108 | ||
| 109 | flag |= __GFP_ZERO; | 109 | flag |= __GFP_ZERO; |
| 110 | again: | 110 | again: |
| 111 | page = NULL; | ||
| 111 | if (!(flag & GFP_ATOMIC)) | 112 | if (!(flag & GFP_ATOMIC)) |
| 112 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); | 113 | page = dma_alloc_from_contiguous(dev, count, get_order(size)); |
| 113 | if (!page) | 114 | if (!page) |
