public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] io_uring/zcrx: fix post open error handling
@ 2026-03-02 22:15 Pavel Begunkov
  2026-03-02 22:17 ` Pavel Begunkov
  2026-03-03  1:47 ` Greg KH
  0 siblings, 2 replies; 4+ messages in thread
From: Pavel Begunkov @ 2026-03-02 22:15 UTC (permalink / raw)
  To: io-uring; +Cc: asml.silence, axboe, netdev, stable, Sasha Levin

[ 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, &reg, 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, &reg, 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


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

* Re: [PATCH 1/1] io_uring/zcrx: fix post open error handling
  2026-03-02 22:15 [PATCH 1/1] io_uring/zcrx: fix post open error handling Pavel Begunkov
@ 2026-03-02 22:17 ` Pavel Begunkov
  2026-03-03  1:47 ` Greg KH
  1 sibling, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2026-03-02 22:17 UTC (permalink / raw)
  To: io-uring; +Cc: axboe, netdev, stable, Sasha Levin

On 3/2/26 22:15, Pavel Begunkov wrote:
> [ 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.

I somehow lost a stable-6.18 label in the process

-- 
Pavel Begunkov


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

* Re: [PATCH 1/1] io_uring/zcrx: fix post open error handling
  2026-03-02 22:15 [PATCH 1/1] io_uring/zcrx: fix post open error handling Pavel Begunkov
  2026-03-02 22:17 ` Pavel Begunkov
@ 2026-03-03  1:47 ` Greg KH
  2026-03-03  8:58   ` Pavel Begunkov
  1 sibling, 1 reply; 4+ messages in thread
From: Greg KH @ 2026-03-03  1:47 UTC (permalink / raw)
  To: Pavel Begunkov; +Cc: io-uring, axboe, netdev, stable, Sasha Levin

On Mon, Mar 02, 2026 at 10:15:43PM +0000, Pavel Begunkov wrote:
> [ 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(-)

What stable kernel(s) is this for?

thanks,

greg k-h

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

* Re: [PATCH 1/1] io_uring/zcrx: fix post open error handling
  2026-03-03  1:47 ` Greg KH
@ 2026-03-03  8:58   ` Pavel Begunkov
  0 siblings, 0 replies; 4+ messages in thread
From: Pavel Begunkov @ 2026-03-03  8:58 UTC (permalink / raw)
  To: Greg KH; +Cc: io-uring, axboe, netdev, stable, Sasha Levin

On 3/3/26 01:47, Greg KH wrote:
> On Mon, Mar 02, 2026 at 10:15:43PM +0000, Pavel Begunkov wrote:
>> [ 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(-)
> 
> What stable kernel(s) is this for?

6.18 please

-- 
Pavel Begunkov


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

end of thread, other threads:[~2026-03-03  8:58 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-02 22:15 [PATCH 1/1] io_uring/zcrx: fix post open error handling Pavel Begunkov
2026-03-02 22:17 ` Pavel Begunkov
2026-03-03  1:47 ` Greg KH
2026-03-03  8:58   ` Pavel Begunkov

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