]> git.baikalelectronics.ru Git - kernel.git/commit
aio: fix race in ring buffer page lookup introduced by page migration support
authorBenjamin LaHaise <bcrl@kvack.org>
Mon, 9 Sep 2013 15:57:59 +0000 (11:57 -0400)
committerBenjamin LaHaise <bcrl@kvack.org>
Mon, 9 Sep 2013 15:57:59 +0000 (11:57 -0400)
commitd61dab3a99df715577e34b4618110cef3098178a
tree97b30abf03e5758fca4eef8572de38b77af54ae8
parent5ff055e66e7b9ea9923b1caec968cb62b60f71b0
aio: fix race in ring buffer page lookup introduced by page migration support

Prior to the introduction of page migration support in "fs/aio: Add support
to aio ring pages migration" / 5a9523ff2dec75f0bc9db8326514f9bfe9bb3906,
mapping of the ring buffer pages was done via get_user_pages() while
retaining mmap_sem held for write.  This avoided possible races with userland
racing an munmap() or mremap().  The page migration patch, however, switched
to using mm_populate() to prime the page mapping.  mm_populate() cannot be
called with mmap_sem held.

Instead of dropping the mmap_sem, revert to the old behaviour and simply
drop the use of mm_populate() since get_user_pages() will cause the pages to
get mapped anyways.  Thanks to Al Viro for spotting this issue.

Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
fs/aio.c