stable.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Pavel Begunkov <asml.silence@gmail.com>
To: stable@vger.kernel.org
Cc: Jens Axboe <axboe@kernel.dk>, asml.silence@gmail.com
Subject: [PATCH stable-5.15 12/13] io_uring: fix wrong arm_poll error handling
Date: Mon, 29 Aug 2022 14:30:23 +0100	[thread overview]
Message-ID: <cd4e6937d06fd243778b5a0eece6e37b9d058900.1661594698.git.asml.silence@gmail.com> (raw)
In-Reply-To: <cover.1661594698.git.asml.silence@gmail.com>

[ upstream commmit 9d2ad2947a53abf5e5e6527a9eeed50a3a4cbc72 ]

Leaving ip.error set when a request was punted to task_work execution is
problematic, don't forget to clear it.

Fixes: aa43477b04025 ("io_uring: poll rework")
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Link: https://lore.kernel.org/r/a6c84ef4182c6962380aebe11b35bdcb25b0ccfb.1655852245.git.asml.silence@gmail.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
[pavel: backport]
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
 fs/io_uring.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 16b0ea1b5bf7..6bcc3798591e 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -5621,8 +5621,10 @@ static int __io_arm_poll_handler(struct io_kiocb *req,
 
 	if (mask) {
 		/* can't multishot if failed, just queue the event we've got */
-		if (unlikely(ipt->error || !ipt->nr_entries))
+		if (unlikely(ipt->error || !ipt->nr_entries)) {
 			poll->events |= EPOLLONESHOT;
+			ipt->error = 0;
+		}
 		__io_poll_execute(req, mask);
 		return 0;
 	}
-- 
2.37.2


  parent reply	other threads:[~2022-08-29 13:34 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29 13:30 [PATCH stable-5.15 00/13] io_uring pollfree Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 01/13] io_uring: correct fill events helpers types Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 02/13] io_uring: clean cqe filling functions Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 03/13] io_uring: refactor poll update Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 04/13] io_uring: move common poll bits Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 05/13] io_uring: kill poll linking optimisation Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 06/13] io_uring: inline io_poll_complete Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 07/13] io_uring: poll rework Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 08/13] io_uring: Remove unused function req_ref_put Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 09/13] io_uring: remove poll entry from list when canceling all Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 10/13] io_uring: bump poll refs to full 31-bits Pavel Begunkov
2022-08-29 13:30 ` [PATCH stable-5.15 11/13] io_uring: fail links when poll fails Pavel Begunkov
2022-08-29 13:30 ` Pavel Begunkov [this message]
2022-08-29 13:30 ` [PATCH stable-5.15 13/13] io_uring: fix UAF due to missing POLLFREE handling Pavel Begunkov
2022-09-01 10:08 ` [PATCH stable-5.15 00/13] io_uring pollfree Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cd4e6937d06fd243778b5a0eece6e37b9d058900.1661594698.git.asml.silence@gmail.com \
    --to=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).