From: Benjamin LaHaise Date: Wed, 7 Aug 2013 22:23:48 +0000 (-0400) Subject: aio: table lookup: verify ctx pointer X-Git-Tag: v3.12-rc1~16^2~4 X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=commitdiff_plain;h=f30d704fe1244c44a984d3d1f47bc648bcc6c9f7;p=linux.git aio: table lookup: verify ctx pointer Another shortcoming of the table lookup patch was revealed where the pointer was not being tested before being dereferenced. Verify this to avoid the NULL pointer dereference. Signed-off-by: Benjamin LaHaise --- diff --git a/fs/aio.c b/fs/aio.c index 3bc068c1cb9c..c3f005dc2d55 100644 --- a/fs/aio.c +++ b/fs/aio.c @@ -812,7 +812,7 @@ static struct kioctx *lookup_ioctx(unsigned long ctx_id) goto out; ctx = table->table[id]; - if (ctx->user_id == ctx_id) { + if (ctx && ctx->user_id == ctx_id) { percpu_ref_get(&ctx->users); ret = ctx; }