1
0

100-MIPS-fix-cache-flushing-for-highmem-pages.patch 886 B

123456789101112131415161718192021222324252627282930
  1. From: Felix Fietkau <nbd@nbd.name>
  2. Subject: MIPS: fix cache flushing for highmem pages
  3. Most cache flush ops were no-op for highmem pages. This led to nasty
  4. segfaults and (in the case of page_address(page) == NULL) kernel
  5. crashes.
  6. Fix this by always flushing highmem pages using kmap/kunmap_atomic
  7. around the actual cache flush. This might be a bit inefficient, but at
  8. least it's stable.
  9. Signed-off-by: Felix Fietkau <nbd@nbd.name>
  10. ---
  11. --- a/arch/mips/mm/cache.c
  12. +++ b/arch/mips/mm/cache.c
  13. @@ -116,6 +116,13 @@ void __flush_anon_page(struct page *page
  14. {
  15. unsigned long addr = (unsigned long) page_address(page);
  16. + if (PageHighMem(page)) {
  17. + addr = (unsigned long)kmap_atomic(page);
  18. + flush_data_cache_page(addr);
  19. + __kunmap_atomic((void *)addr);
  20. + return;
  21. + }
  22. +
  23. if (pages_do_alias(addr, vmaddr)) {
  24. if (page_mapcount(page) && !Page_dcache_dirty(page)) {
  25. void *kaddr;