提交 bed177de 编写于 作者: Z zhangyi (F) 提交者: Zheng Zengkai

aio: add timeout validity check for io_[p]getevents

maillist inclusion
category: bugfix
bugzilla: 47445
CVE: NA

Reference: https://lore.kernel.org/lkml/1564451504-27906-1-git-send-email-yi.zhang@huawei.com/

---------------------------

io_[p]getevents syscall should return -EINVAL if timeout is out of
range, add this validity check.
Signed-off-by: Nzhangyi (F) <yi.zhang@huawei.com>
Reviewed-by: NJeff Moyer <jmoyer@redhat.com>
Cc: Jeff Moyer <jmoyer@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>
Cc: Deepa Dinamani <deepa.kernel@gmail.com>
Signed-off-by: Nyangerkun <yangerkun@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 dd28132c
......@@ -2050,10 +2050,17 @@ static long do_io_getevents(aio_context_t ctx_id,
struct io_event __user *events,
struct timespec64 *ts)
{
ktime_t until = ts ? timespec64_to_ktime(*ts) : KTIME_MAX;
struct kioctx *ioctx = lookup_ioctx(ctx_id);
ktime_t until = KTIME_MAX;
struct kioctx *ioctx = NULL;
long ret = -EINVAL;
if (ts) {
if (!timespec64_valid(ts))
return ret;
until = timespec64_to_ktime(*ts);
}
ioctx = lookup_ioctx(ctx_id);
if (likely(ioctx)) {
if (likely(min_nr <= nr && min_nr >= 0))
ret = read_events(ioctx, min_nr, nr, events, until);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册