Commit 204e9011 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] io_getevents leak fix

Spotted by Suparna: if the first range check fails, we leak a ref on the io
context.
parent e7b8d7bd
......@@ -1240,10 +1240,8 @@ asmlinkage long sys_io_getevents(aio_context_t ctx_id,
struct kioctx *ioctx = lookup_ioctx(ctx_id);
long ret = -EINVAL;
if (unlikely(min_nr > nr || min_nr < 0 || nr < 0))
return ret;
if (likely(NULL != ioctx)) {
if (likely(ioctx)) {
if (likely(min_nr <= nr && min_nr >= 0 && nr >= 0))
ret = read_events(ioctx, min_nr, nr, events, timeout);
put_ioctx(ioctx);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment