From f30d704fe1244c44a984d3d1f47bc648bcc6c9f7 Mon Sep 17 00:00:00 2001 From: Benjamin LaHaise Date: Wed, 7 Aug 2013 18:23:48 -0400 Subject: 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 --- fs/aio.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'fs/aio.c') 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; } -- cgit v1.2.3