瀏覽代碼

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 <bcrl@kvack.org>
Benjamin LaHaise 12 年之前
父節點
當前提交
f30d704fe1
共有 1 個文件被更改,包括 1 次插入1 次删除
  1. 1 1
      fs/aio.c

+ 1 - 1
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;
 	}