public inbox for [email protected]
 help / color / mirror / Atom feed
* [PATCH] io_uring: fix io_drain_req()
@ 2021-07-11 21:41 Pavel Begunkov
  2021-07-11 22:39 ` Jens Axboe
  0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2021-07-11 21:41 UTC (permalink / raw)
  To: Jens Axboe, io-uring; +Cc: syzbot+ba6fcd859210f4e9e109

io_drain_req() return whether the request has been consumed or not, not
an error code. Fix a stupid mistake slipped from optimisation patches.

Reported-by: [email protected]
Fixes: 76cc33d79175a ("io_uring: refactor io_req_defer()")
Signed-off-by: Pavel Begunkov <[email protected]>
---
 fs/io_uring.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/io_uring.c b/fs/io_uring.c
index 118215211bb2..0cac361bf6b8 100644
--- a/fs/io_uring.c
+++ b/fs/io_uring.c
@@ -6019,11 +6019,13 @@ static bool io_drain_req(struct io_kiocb *req)
 
 	ret = io_req_prep_async(req);
 	if (ret)
-		return ret;
+		goto fail;
 	io_prep_async_link(req);
 	de = kmalloc(sizeof(*de), GFP_KERNEL);
 	if (!de) {
-		io_req_complete_failed(req, -ENOMEM);
+		ret = -ENOMEM;
+fail:
+		io_req_complete_failed(req, ret);
 		return true;
 	}
 
-- 
2.32.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] io_uring: fix io_drain_req()
  2021-07-11 21:41 [PATCH] io_uring: fix io_drain_req() Pavel Begunkov
@ 2021-07-11 22:39 ` Jens Axboe
  0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2021-07-11 22:39 UTC (permalink / raw)
  To: Pavel Begunkov, io-uring; +Cc: syzbot+ba6fcd859210f4e9e109

On 7/11/21 3:41 PM, Pavel Begunkov wrote:
> io_drain_req() return whether the request has been consumed or not, not
> an error code. Fix a stupid mistake slipped from optimisation patches.

Good catch, thanks for fixing this up. Applied.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-07-11 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-11 21:41 [PATCH] io_uring: fix io_drain_req() Pavel Begunkov
2021-07-11 22:39 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox