Skip to content

Commit

Permalink
aio: table lookup: verify ctx pointer
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
bcrl committed Aug 7, 2013
1 parent 0bdd5ca commit f30d704
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion fs/aio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit f30d704

Please sign in to comment.