From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 384391C31 for ; Wed, 23 Nov 2022 09:53:21 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9191BC433B5; Wed, 23 Nov 2022 09:53:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1669197200; bh=QUidASXV2Hx8XkfztRf8O5GMKzZDoGx9Zp/e2NlKmPw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=v450pTl0nWC3M5ijK68qZQARpc5OtRZTnUrc1LoLsK0Ot2/TMJCeXzMxAS2orTaEi yf9X6hVAZYK97027cEAELiCjdjcT3WG8bULZY7+AYAp2sK6PTncmWmAHBnUSZO/Yyx +WiD1dkpIlAlLHzFMN15DbSVQthWAPjeL88Zjbfw= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Pavel Begunkov , Jens Axboe Subject: [PATCH 6.0 226/314] io_uring: update res mask in io_poll_check_events Date: Wed, 23 Nov 2022 09:51:11 +0100 Message-Id: <20221123084635.768677526@linuxfoundation.org> X-Mailer: git-send-email 2.38.1 In-Reply-To: <20221123084625.457073469@linuxfoundation.org> References: <20221123084625.457073469@linuxfoundation.org> User-Agent: quilt/0.67 Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Pavel Begunkov commit b98186aee22fa593bc8c6b2c5d839c2ee518bc8c upstream. When io_poll_check_events() collides with someone attempting to queue a task work, it'll spin for one more time. However, it'll continue to use the mask from the first iteration instead of updating it. For example, if the first wake up was a EPOLLIN and the second EPOLLOUT, the userspace will not get EPOLLOUT in time. Clear the mask for all subsequent iterations to force vfs_poll(). Cc: stable@vger.kernel.org Fixes: aa43477b04025 ("io_uring: poll rework") Signed-off-by: Pavel Begunkov Link: https://lore.kernel.org/r/2dac97e8f691231049cb259c4ae57e79e40b537c.1668710222.git.asml.silence@gmail.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- io_uring/poll.c | 3 +++ 1 file changed, 3 insertions(+) --- a/io_uring/poll.c +++ b/io_uring/poll.c @@ -256,6 +256,9 @@ static int io_poll_check_events(struct i return ret; } + /* force the next iteration to vfs_poll() */ + req->cqe.res = 0; + /* * Release all references, retry if someone tried to restart * task_work while we were executing it.