101-MIPS-fix-cache-flushing-for-highmem-pages.patch 930 B

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