Skip to content

Commit 28148a1

Browse files
thejhstffrdhrn
authored andcommitted
openrisc: Fix pagewalk usage in arch_dma_{clear, set}_uncached
Since commit 8782fb6 ("mm: pagewalk: Fix race between unmap and page walker"), walk_page_range() on kernel ranges won't work anymore, walk_page_range_novma() must be used instead. Note: I don't have an openrisc development setup, so this is completely untested. Fixes: 8782fb6 ("mm: pagewalk: Fix race between unmap and page walker") Signed-off-by: Jann Horn <[email protected]> Signed-off-by: Stafford Horne <[email protected]>
1 parent f76349c commit 28148a1

File tree

1 file changed

+8
-8
lines changed
  • arch/openrisc/kernel

1 file changed

+8
-8
lines changed

arch/openrisc/kernel/dma.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,10 @@ void *arch_dma_set_uncached(void *cpu_addr, size_t size)
7474
* We need to iterate through the pages, clearing the dcache for
7575
* them and setting the cache-inhibit bit.
7676
*/
77-
mmap_read_lock(&init_mm);
78-
error = walk_page_range(&init_mm, va, va + size, &set_nocache_walk_ops,
79-
NULL);
80-
mmap_read_unlock(&init_mm);
77+
mmap_write_lock(&init_mm);
78+
error = walk_page_range_novma(&init_mm, va, va + size,
79+
&set_nocache_walk_ops, NULL, NULL);
80+
mmap_write_unlock(&init_mm);
8181

8282
if (error)
8383
return ERR_PTR(error);
@@ -88,11 +88,11 @@ void arch_dma_clear_uncached(void *cpu_addr, size_t size)
8888
{
8989
unsigned long va = (unsigned long)cpu_addr;
9090

91-
mmap_read_lock(&init_mm);
91+
mmap_write_lock(&init_mm);
9292
/* walk_page_range shouldn't be able to fail here */
93-
WARN_ON(walk_page_range(&init_mm, va, va + size,
94-
&clear_nocache_walk_ops, NULL));
95-
mmap_read_unlock(&init_mm);
93+
WARN_ON(walk_page_range_novma(&init_mm, va, va + size,
94+
&clear_nocache_walk_ops, NULL, NULL));
95+
mmap_write_unlock(&init_mm);
9696
}
9797

9898
void arch_sync_dma_for_device(phys_addr_t addr, size_t size,

0 commit comments

Comments
 (0)