From: Benjamin LaHaise Date: Sat, 21 Dec 2013 20:49:28 +0000 (-0500) Subject: aio: fix kioctx leak introduced by "aio: Fix a trinity splat" X-Git-Tag: v3.12.7~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=200067a3f3e73eecb457c5bf25fec875cf42d53d;p=kernel%2Fkernel-generic.git aio: fix kioctx leak introduced by "aio: Fix a trinity splat" commit 1881686f842065d2f92ec9c6424830ffc17d23b0 upstream. e34ecee2ae791df674dfb466ce40692ca6218e43 reworked the percpu reference counting to correct a bug trinity found. Unfortunately, the change lead to kioctxes being leaked because there was no final reference count to put. Add that reference count back in to fix things. Signed-off-by: Benjamin LaHaise Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/aio.c b/fs/aio.c index 6efb7f6..fd1c0ba 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -652,7 +652,8 @@ static struct kioctx *ioctx_alloc(unsigned nr_events) aio_nr += ctx->max_reqs; spin_unlock(&aio_nr_lock); - percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */ + percpu_ref_get(&ctx->users); /* io_setup() will drop this ref */ + percpu_ref_get(&ctx->reqs); /* free_ioctx_users() will drop this */ err = ioctx_add_table(ctx, mm); if (err)