diff --git a/arch/riscv/mm/fault.c b/arch/riscv/mm/fault.c index 3b430fb18de3bfe6a6eaa8f63aa98920eb7c2d12..bdc70d3d507f18d1426ab798b4fa4c1b5eebcd90 100644 --- a/arch/riscv/mm/fault.c +++ b/arch/riscv/mm/fault.c @@ -208,6 +208,9 @@ asmlinkage void do_page_fault(struct pt_regs *regs) perf_sw_event(PERF_COUNT_SW_PAGE_FAULTS, 1, regs, addr); + if (cause == EXC_STORE_PAGE_FAULT) + flags |= FAULT_FLAG_WRITE; + retry: mmap_read_lock(mm); vma = find_vma(mm, addr); @@ -251,7 +254,6 @@ asmlinkage void do_page_fault(struct pt_regs *regs) bad_area(regs, mm, code, addr); return; } - flags |= FAULT_FLAG_WRITE; break; default: panic("%s: unhandled cause %lu", __func__, cause);