Davidlohr Bueso 7b24d8616b mm, hugetlb: fix race in region tracking
There is a race condition if we map a same file on different processes.
Region tracking is protected by mmap_sem and hugetlb_instantiation_mutex.
When we do mmap, we don't grab a hugetlb_instantiation_mutex, but only
mmap_sem (exclusively).  This doesn't prevent other tasks from modifying
the region structure, so it can be modified by two processes
concurrently.

To solve this, introduce a spinlock to resv_map and make region
manipulation function grab it before they do actual work.

[davidlohr@hp.com: updated changelog]
Signed-off-by: Davidlohr Bueso <davidlohr@hp.com>
Signed-off-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Suggested-by: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Acked-by: David Gibson <david@gibson.dropbear.id.au>
Cc: David Gibson <david@gibson.dropbear.id.au>
Cc: Naoya Horiguchi <n-horiguchi@ah.jp.nec.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2014-04-03 16:20:59 -07:00
..
2012-01-03 22:54:56 -05:00
2011-07-26 16:49:47 -07:00
2014-03-04 07:55:47 -08:00
2014-01-30 16:56:55 -08:00
2014-03-04 07:55:47 -08:00
2014-01-23 16:36:52 -08:00
2014-01-27 21:02:39 -08:00
2013-10-16 21:35:53 -07:00
2012-06-20 14:39:36 -07:00
2014-04-03 16:20:58 -07:00
2014-04-03 16:20:58 -07:00
2014-04-02 09:16:17 +02:00
2014-03-04 07:55:47 -08:00
2014-01-30 16:56:55 -08:00