io_uring: hold mmap_sem for mm->locked_vm manipulation
authorJens Axboe <axboe@kernel.dk>
Thu, 17 Dec 2020 14:53:33 +0000 (07:53 -0700)
committerJens Axboe <axboe@kernel.dk>
Thu, 17 Dec 2020 14:53:33 +0000 (07:53 -0700)
commit4bc4a912534a72f1c96f483448f0be16e5a48063
tree9db2abd90af8c6c3c3c9ec9d94fbf649ba7d7b34
parenta146468d76e0462393a3e15b77b8b3ede60e2d06
io_uring: hold mmap_sem for mm->locked_vm manipulation

The kernel doesn't seem to have clear rules around this, but various
spots are using the mmap_sem to serialize access to modifying the
locked_vm count. Play it safe and lock the mm for write when accounting
or unaccounting locked memory.

Signed-off-by: Jens Axboe <axboe@kernel.dk>
fs/io_uring.c