From: Pavel Begunkov <asml.silence@gmail.com>
To: io-uring@vger.kernel.org
Cc: asml.silence@gmail.com, axboe@kernel.dk, netdev@vger.kernel.org,
stable@vger.kernel.org, Sasha Levin <sashal@kernel.org>
Subject: [PATCH 1/1] io_uring/zcrx: fix post open error handling
Date: Mon, 2 Mar 2026 22:15:43 +0000 [thread overview]
Message-ID: <ae4f2296e2c33bb65ef2a1487b120033879e493f.1772489730.git.asml.silence@gmail.com> (raw)
[ upstream commit 5d540e4508950c674d6feef1d95463d039bbf4f5 ]
5d540e4508950 ("io_uring/zcrx: fix post open error handling") fixes some
post queue open problems. Instead of picking all dependencies for that
patch just move post open error handling out of the way, so once a queue
is open we can always report a success.
Move copy_to_user earlier before open, and xa_store() should already
never fail as the slot is explicitly pre-allocated.
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 20 +++++++++-----------
1 file changed, 9 insertions(+), 11 deletions(-)
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index c524be7109c2..208d03443020 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -625,6 +625,14 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
if (ret)
goto netdev_put_unlock;
+ reg.zcrx_id = id;
+ if (copy_to_user(arg, ®, sizeof(reg)) ||
+ copy_to_user(u64_to_user_ptr(reg.region_ptr), &rd, sizeof(rd)) ||
+ copy_to_user(u64_to_user_ptr(reg.area_ptr), &area, sizeof(area))) {
+ ret = -EFAULT;
+ goto netdev_put_unlock;
+ }
+
mp_param.mp_ops = &io_uring_pp_zc_ops;
mp_param.mp_priv = ifq;
ret = __net_mp_open_rxq(ifq->netdev, reg.if_rxq, &mp_param, NULL);
@@ -633,21 +641,11 @@ int io_register_zcrx_ifq(struct io_ring_ctx *ctx,
netdev_unlock(ifq->netdev);
ifq->if_rxq = reg.if_rxq;
- reg.zcrx_id = id;
-
scoped_guard(mutex, &ctx->mmap_lock) {
/* publish ifq */
- ret = -ENOMEM;
- if (xa_store(&ctx->zcrx_ctxs, id, ifq, GFP_KERNEL))
- goto err;
+ xa_store(&ctx->zcrx_ctxs, id, ifq, GFP_KERNEL);
}
- if (copy_to_user(arg, ®, sizeof(reg)) ||
- copy_to_user(u64_to_user_ptr(reg.region_ptr), &rd, sizeof(rd)) ||
- copy_to_user(u64_to_user_ptr(reg.area_ptr), &area, sizeof(area))) {
- ret = -EFAULT;
- goto err;
- }
return 0;
netdev_put_unlock:
netdev_put(ifq->netdev, &ifq->netdev_tracker);
--
2.53.0
next reply other threads:[~2026-03-02 22:15 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-02 22:15 Pavel Begunkov [this message]
2026-03-02 22:17 ` [PATCH 1/1] io_uring/zcrx: fix post open error handling Pavel Begunkov
2026-03-03 1:47 ` Greg KH
2026-03-03 8:58 ` Pavel Begunkov
-- strict thread matches above, loose matches on Subject: below --
2026-02-14 22:20 Pavel Begunkov
2026-02-15 1:06 ` Jens Axboe
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=ae4f2296e2c33bb65ef2a1487b120033879e493f.1772489730.git.asml.silence@gmail.com \
--to=asml.silence@gmail.com \
--cc=axboe@kernel.dk \
--cc=io-uring@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=sashal@kernel.org \
--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