public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] aio: prevent double free in ioctx_alloc
@ 2013-11-19 22:33 Sasha Levin
  2013-11-19 22:33 ` [PATCH 2/2] aio: nullify aio->ring_pages after freeing it Sasha Levin
  2013-11-19 22:45 ` [PATCH 1/2] aio: prevent double free in ioctx_alloc Benjamin LaHaise
  0 siblings, 2 replies; 4+ messages in thread
From: Sasha Levin @ 2013-11-19 22:33 UTC (permalink / raw)
  To: bcrl, viro; +Cc: linux-aio, linux-fsdevel, linux-kernel, Sasha Levin

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>
---
 fs/aio.c |    1 -
 1 file changed, 1 deletion(-)

diff --git a/fs/aio.c b/fs/aio.c
index 699f53e..8b387a1 100644
--- a/fs/aio.c
+++ b/fs/aio.c
@@ -661,7 +661,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);
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-19 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-19 22:33 [PATCH 1/2] aio: prevent double free in ioctx_alloc Sasha Levin
2013-11-19 22:33 ` [PATCH 2/2] aio: nullify aio->ring_pages after freeing it Sasha Levin
2013-11-19 22:45   ` Benjamin LaHaise
2013-11-19 22:45 ` [PATCH 1/2] aio: prevent double free in ioctx_alloc Benjamin LaHaise

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox