Skip to content

Commit dbab31a

Browse files
peterfeinertorvalds
authored andcommitted
mm: softdirty: keep bit when zapping file pte
This fixes the same bug as b43790e ("mm: softdirty: don't forget to save file map softdiry bit on unmap") and 9aed861 ("mm/memory.c: don't forget to set softdirty on file mapped fault") where the return value of pte_*mksoft_dirty was being ignored. To be sure that no other pte/pmd "mk" function return values were being ignored, I annotated the functions in arch/x86/include/asm/pgtable.h with __must_check and rebuilt. The userspace effect of this bug is that the softdirty mark might be lost if a file mapped pte get zapped. Signed-off-by: Peter Feiner <pfeiner@google.com> Acked-by: Cyrill Gorcunov <gorcunov@openvz.org> Cc: Pavel Emelyanov <xemul@parallels.com> Cc: Jamie Liu <jamieliu@google.com> Cc: Hugh Dickins <hughd@google.com> Cc: <stable@vger.kernel.org> [3.12+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 6ff66ac commit dbab31a

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

‎mm/memory.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1127,7 +1127,7 @@ static unsigned long zap_pte_range(struct mmu_gather *tlb,
11271127
addr) != page->index) {
11281128
pte_t ptfile = pgoff_to_pte(page->index);
11291129
if (pte_soft_dirty(ptent))
1130-
pte_file_mksoft_dirty(ptfile);
1130+
ptfile = pte_file_mksoft_dirty(ptfile);
11311131
set_pte_at(mm, addr, pte, ptfile);
11321132
}
11331133
if (PageAnon(page))

0 commit comments

Comments
 (0)