aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2013-12-06 11:32:59 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2013-12-06 11:32:59 -0500
commitc537aba00e3f1df8ce6c7c9fcb98b82c0c2d1d2c (patch)
tree487b3ceb33b2903fa03ead519a8459d994f77dc4
parent7adfff587bc4d9ed8f85a31b12464513fda886a2 (diff)
parentd1b9432712a25eeb06114fb4b587133525a47de5 (diff)
Merge git://git.kvack.org/~bcrl/aio-next
Pull aio fix from Benjamin LaHaise: "AIO fix from Gu Zheng that fixes a GPF that Dave Jones uncovered with trinity" * git://git.kvack.org/~bcrl/aio-next: aio: clean up aio ring in the fail path
-rw-r--r--fs/aio.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/fs/aio.c b/fs/aio.c
index 08159ed13649..6efb7f6cb22e 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -367,8 +367,10 @@ static int aio_setup_ring(struct kioctx *ctx)
367 if (nr_pages > AIO_RING_PAGES) { 367 if (nr_pages > AIO_RING_PAGES) {
368 ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *), 368 ctx->ring_pages = kcalloc(nr_pages, sizeof(struct page *),
369 GFP_KERNEL); 369 GFP_KERNEL);
370 if (!ctx->ring_pages) 370 if (!ctx->ring_pages) {
371 put_aio_ring_file(ctx);
371 return -ENOMEM; 372 return -ENOMEM;
373 }
372 } 374 }
373 375
374 ctx->mmap_size = nr_pages * PAGE_SIZE; 376 ctx->mmap_size = nr_pages * PAGE_SIZE;
@@ -645,7 +647,7 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
645 aio_nr + nr_events < aio_nr) { 647 aio_nr + nr_events < aio_nr) {
646 spin_unlock(&aio_nr_lock); 648 spin_unlock(&aio_nr_lock);
647 err = -EAGAIN; 649 err = -EAGAIN;
648 goto err; 650 goto err_ctx;
649 } 651 }
650 aio_nr += ctx->max_reqs; 652 aio_nr += ctx->max_reqs;
651 spin_unlock(&aio_nr_lock); 653 spin_unlock(&aio_nr_lock);
@@ -662,6 +664,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
662 664
663err_cleanup: 665err_cleanup:
664 aio_nr_sub(ctx->max_reqs); 666 aio_nr_sub(ctx->max_reqs);
667err_ctx:
668 aio_free_ring(ctx);
665err: 669err:
666 free_percpu(ctx->cpu); 670 free_percpu(ctx->cpu);
667 free_percpu(ctx->reqs.pcpu_count); 671 free_percpu(ctx->reqs.pcpu_count);