diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2013-12-06 11:32:59 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-12-06 11:32:59 -0500 |
commit | c537aba00e3f1df8ce6c7c9fcb98b82c0c2d1d2c (patch) | |
tree | 487b3ceb33b2903fa03ead519a8459d994f77dc4 /fs | |
parent | 7adfff587bc4d9ed8f85a31b12464513fda886a2 (diff) | |
parent | d1b9432712a25eeb06114fb4b587133525a47de5 (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
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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 | ||
663 | err_cleanup: | 665 | err_cleanup: |
664 | aio_nr_sub(ctx->max_reqs); | 666 | aio_nr_sub(ctx->max_reqs); |
667 | err_ctx: | ||
668 | aio_free_ring(ctx); | ||
665 | err: | 669 | err: |
666 | free_percpu(ctx->cpu); | 670 | free_percpu(ctx->cpu); |
667 | free_percpu(ctx->reqs.pcpu_count); | 671 | free_percpu(ctx->reqs.pcpu_count); |