Skip to content

Commit c080e26

Browse files
committed
x86: dma-mapping: fix broken allocation when dma_mask has been provided
Commit 0a2b9a6 ("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 <[email protected]> Signed-off-by: Marek Szyprowski <[email protected]> Acked-by: Michal Nazarewicz <[email protected]>
1 parent fdb1117 commit c080e26

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/x86/kernel/pci-dma.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,14 +100,15 @@ void *dma_generic_alloc_coherent(struct device *dev, size_t size,
100100
struct dma_attrs *attrs)
101101
{
102102
unsigned long dma_mask;
103-
struct page *page = NULL;
103+
struct page *page;
104104
unsigned int count = PAGE_ALIGN(size) >> PAGE_SHIFT;
105105
dma_addr_t addr;
106106

107107
dma_mask = dma_alloc_coherent_mask(dev, flag);
108108

109109
flag |= __GFP_ZERO;
110110
again:
111+
page = NULL;
111112
if (!(flag & GFP_ATOMIC))
112113
page = dma_alloc_from_contiguous(dev, count, get_order(size));
113114
if (!page)

0 commit comments

Comments
 (0)