]> git.baikalelectronics.ru Git - kernel.git/commit
mm: close race between do_fault_around() and fault_around_bytes_set()
authorKirill A. Shutemov <kirill.shutemov@linux.intel.com>
Wed, 6 Aug 2014 23:08:05 +0000 (16:08 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 7 Aug 2014 01:01:22 +0000 (18:01 -0700)
commitf74dafc8b9a6fca9b0859793267244b78cf9b07c
tree805e451bb46a2d6091db0d9e23c7f11422aa4121
parent8d560ee905ab71a13b872757cc0ff1df272d592d
mm: close race between do_fault_around() and fault_around_bytes_set()

Things can go wrong if fault_around_bytes will be changed under
do_fault_around(): between fault_around_mask() and fault_around_pages().

Let's read fault_around_bytes only once during do_fault_around() and
calculate mask based on the reading.

Note: fault_around_bytes can only be updated via debug interface.  Also
I've tried but was not able to trigger a bad behaviour without the
patch.  So I would not consider this patch as urgent.

Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Cc: Andrey Ryabinin <a.ryabinin@samsung.com>
Cc: Sasha Levin <sasha.levin@oracle.com>
Cc: David Rientjes <rientjes@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory.c