aio: prevent double free in ioctx_alloc
Linux-MTD Mailing List
linux-mtd at lists.infradead.org
Fri Nov 22 17:59:04 EST 2013
Gitweb: http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=d558023207e008a4476a3b7bb8706b2a2bf5d84f
Commit: d558023207e008a4476a3b7bb8706b2a2bf5d84f
Parent: 13fd8a5dc3cfaf0699262a3b5ad4898752fe64da
Author: Sasha Levin <sasha.levin at oracle.com>
AuthorDate: Tue Nov 19 17:33:02 2013 -0500
Committer: Benjamin LaHaise <bcrl at kvack.org>
CommitDate: Tue Nov 19 17:40:48 2013 -0500
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 at oracle.com>
Signed-off-by: Benjamin LaHaise <bcrl at kvack.org>
---
fs/aio.c | 1 -
1 file changed, 1 deletion(-)
diff --git a/fs/aio.c b/fs/aio.c
index ee77dc1..6313533 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -610,7 +610,6 @@ static struct kioctx *ioctx_alloc(unsigned nr_events)
err_cleanup:
aio_nr_sub(ctx->max_reqs);
err:
- aio_free_ring(ctx);
free_percpu(ctx->cpu);
free_percpu(ctx->reqs.pcpu_count);
free_percpu(ctx->users.pcpu_count);
More information about the linux-mtd-cvs
mailing list