summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@linux.dev>2023-01-18 07:05:47 -0500
committerKent Overstreet <kent.overstreet@linux.dev>2023-01-18 10:27:20 -0500
commit3cd3ac432d8ac919ac1f66a888b2503229bf65dd (patch)
treeee44b328d6575c66c42772e2008a7fba6acdc1b7
parent81e52aaaa94d5dda45dcfb130a4cb93727aa934e (diff)
fs/aio: Use kmap_local() instead of kmap()
Originally, we used kmap() instead of kmap_atomic() for reading events out of the completion ringbuffer because we're using copy_to_user(), which can fault. Now that kmap_local() is a thing, use that instead. Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Cc: Benjamin LaHaise <bcrl@kvack.org Cc: linux-aio@kvack.org Cc: linux-fsdevel@vger.kernel.org
-rw-r--r--fs/aio.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 5b2ff20ad322..3f795ed2a21b 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -1246,10 +1246,10 @@ static long aio_read_events_ring(struct kioctx *ctx,
avail = min(avail, nr - ret);
avail = min_t(long, avail, AIO_EVENTS_PER_PAGE - pos);
- ev = kmap(page);
+ ev = kmap_local_page(page);
copy_ret = copy_to_user(event + ret, ev + pos,
sizeof(*ev) * avail);
- kunmap(page);
+ kunmap_local(ev);
if (unlikely(copy_ret)) {
ret = -EFAULT;