diff options
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); |
