[prev in list] [next in list] [prev in thread] [next in thread]
List: linux-aio
Subject: [PATCH v3 3/3] aio_free_ring: don't do page_count(NULL)
From: Oleg Nesterov <oleg () redhat ! com>
Date: 2015-06-18 17:52:12
Message-ID: 20150618175212.GA10067 () redhat ! com
[Download RAW message or body]
aio_free_ring() can actually see the NULL page in ->ring_pages[],
this can happen if aio_setup_ring() fails.
And in this case page_count(ctx->ring_pages[i]) can OOPS.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Reviewed-by: Jeff Moyer <jmoyer@redhat.com>
---
fs/aio.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/fs/aio.c b/fs/aio.c
index d63a889..b9947ed 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -292,12 +292,12 @@ static void aio_free_ring(struct kioctx *ctx)
put_aio_ring_file(ctx);
for (i = 0; i < ctx->nr_pages; i++) {
- struct page *page;
- pr_debug("pid(%d) [%d] page->count=%d\n", current->pid, i,
- page_count(ctx->ring_pages[i]));
- page = ctx->ring_pages[i];
+ struct page *page = ctx->ring_pages[i];
if (!page)
continue;
+
+ pr_debug("pid(%d) [%d] page->count=%d\n",
+ current->pid, i, page_count(page));
ctx->ring_pages[i] = NULL;
put_page(page);
}
--
1.5.5.1
--
To unsubscribe, send a message with 'unsubscribe linux-aio' in
the body to majordomo@kvack.org. For more info on Linux AIO,
see: http://www.kvack.org/aio/
Don't email: <a href=mailto:"aart@kvack.org">aart@kvack.org</a>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic