OSDN Git Service

ioctx_alloc(): fix vma (and file) leak on failure
[uclinux-h8/linux.git] / fs / aio.c
index 58c33dc..a793f70 100644 (file)
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -731,6 +731,9 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
 err_cleanup:
        aio_nr_sub(ctx->max_reqs);
 err_ctx:
+       atomic_set(&ctx->dead, 1);
+       if (ctx->mmap_size)
+               vm_munmap(ctx->mmap_base, ctx->mmap_size);
        aio_free_ring(ctx);
 err:
        mutex_unlock(&ctx->ring_lock);