diff options
author | Sasha Levin <sasha.levin@oracle.com> | 2013-11-19 17:33:02 -0500 |
---|---|---|
committer | Benjamin LaHaise <bcrl@kvack.org> | 2013-11-19 17:40:48 -0500 |
commit | d558023207e008a4476a3b7bb8706b2a2bf5d84f (patch) | |
tree | 3099defaf443113295568a51fe6bbab72b34542c /fs | |
parent | 13fd8a5dc3cfaf0699262a3b5ad4898752fe64da (diff) |
aio: prevent double free in ioctx_alloc
ioctx_alloc() calls aio_setup_ring() to allocate a ring. If aio_setup_ring()
fails to do so it would call aio_free_ring() before returning, but
ioctx_alloc() would call aio_free_ring() again causing a double free of
the ring.
This is easily reproducible from userspace.
Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
Signed-off-by: Benjamin LaHaise <bcrl@kvack.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/aio.c | 1 |
1 files changed, 0 insertions, 1 deletions
@@ -610,7 +610,6 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) | |||
610 | err_cleanup: | 610 | err_cleanup: |
611 | aio_nr_sub(ctx->max_reqs); | 611 | aio_nr_sub(ctx->max_reqs); |
612 | err: | 612 | err: |
613 | aio_free_ring(ctx); | ||
614 | free_percpu(ctx->cpu); | 613 | free_percpu(ctx->cpu); |
615 | free_percpu(ctx->reqs.pcpu_count); | 614 | free_percpu(ctx->reqs.pcpu_count); |
616 | free_percpu(ctx->users.pcpu_count); | 615 | free_percpu(ctx->users.pcpu_count); |