提交 2d9e350d 编写于 作者: A Al Viro 提交者: Xie XiuQi

aio_poll_wake(): don't set ->woken if we ignore the wakeup

euler inclusion
category: bugfix
bugzilla: 10679
CVE: NA

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

In case of early wakeups, aio_poll() assumes that aio_poll_complete()
has either already happened or is imminent.  In that case we do not
want to put iocb on the list of cancellables.  However, ignored
wakeups need to be treated as if wakeup has not happened at all.
Trivially fixed by having aio_poll_wake() set ->woken only after
it's committed to taking iocb out of the waitqueue.

Link: https://patchwork.kernel.org/patch/10842107/Suggested-by: Nzhengbin <zhengbin13@huawei.com>
Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Nzhengbin <zhengbin13@huawei.com>
Reviewed-by: Nzhangyi (F) <yi.zhang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9b15cfc8
......@@ -1662,13 +1662,13 @@ static int aio_poll_wake(struct wait_queue_entry *wait, unsigned mode, int sync,
struct aio_kiocb *iocb = container_of(req, struct aio_kiocb, poll);
__poll_t mask = key_to_poll(key);
/* for instances that support it check for an event match first: */
if (mask && !(mask & req->events))
return 0;
req->woken = true;
/* for instances that support it check for an event match first: */
if (mask) {
if (!(mask & req->events))
return 0;
/* try to complete the iocb inline if we can: */
if (spin_trylock(&iocb->ki_ctx->ctx_lock)) {
list_del(&iocb->ki_list);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册