]> git.baikalelectronics.ru Git - kernel.git/commit
aio: fix use-after-free in aio_migratepage
authorBenjamin LaHaise <bcrl@kvack.org>
Fri, 27 Sep 2013 00:34:51 +0000 (20:34 -0400)
committerBenjamin LaHaise <bcrl@kvack.org>
Fri, 27 Sep 2013 00:34:51 +0000 (20:34 -0400)
commit71bf0df393bbc5f499e31fe2be014bbd77e15dd4
treeea2f75c681f4891152e22eb43f45c1c2489e0375
parent29aa408d191c0c32a7d6e7003f58580492a53e13
aio: fix use-after-free in aio_migratepage

Dmitry Vyukov managed to trigger a case where aio_migratepage can cause a
use-after-free during teardown of the aio ring buffer's mapping.  This turns
out to be caused by access to the ioctx's ring_pages via the migratepage
operation which was not being protected by any locks during ioctx freeing.
Use the address_space's private_lock to protect use and updates of the mapping's
private_data, and make ioctx teardown unlink the ioctx from the address space.

Reported-by: Dmitry Vyukov <dvyukov@google.com>
Tested-by: Dmitry Vyukov <dvyukov@google.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
fs/aio.c