* [PATCH 1/1] io_uring/zcrx: fix overshooting recv limit
@ 2025-10-08 12:38 Pavel Begunkov
2025-10-08 17:32 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Pavel Begunkov @ 2025-10-08 12:38 UTC (permalink / raw)
To: io-uring; +Cc: asml.silence, axboe, netdev, Matthias Jasny
It's reported that sometimes a zcrx request can receive more than was
requested. It's caused by io_zcrx_recv_skb() adjusting desc->count for
all received buffers including frag lists, but then doing recursive
calls to process frag list skbs, which leads to desc->count double
accounting and underflow.
Reported-and-tested-by: Matthias Jasny <matthiasjasny@gmail.com>
Fixes: 6699ec9a23f85 ("io_uring/zcrx: add a read limit to recvzc requests")
Cc: stable@vger.kernel.org
Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
---
io_uring/zcrx.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/io_uring/zcrx.c b/io_uring/zcrx.c
index 723e4266b91f..ef73440b605a 100644
--- a/io_uring/zcrx.c
+++ b/io_uring/zcrx.c
@@ -1236,12 +1236,16 @@ io_zcrx_recv_skb(read_descriptor_t *desc, struct sk_buff *skb,
end = start + frag_iter->len;
if (offset < end) {
+ size_t count;
+
copy = end - offset;
if (copy > len)
copy = len;
off = offset - start;
+ count = desc->count;
ret = io_zcrx_recv_skb(desc, frag_iter, off, copy);
+ desc->count = count;
if (ret < 0)
goto out;
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/1] io_uring/zcrx: fix overshooting recv limit
2025-10-08 12:38 [PATCH 1/1] io_uring/zcrx: fix overshooting recv limit Pavel Begunkov
@ 2025-10-08 17:32 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2025-10-08 17:32 UTC (permalink / raw)
To: io-uring, Pavel Begunkov; +Cc: netdev, Matthias Jasny
On Wed, 08 Oct 2025 13:38:06 +0100, Pavel Begunkov wrote:
> It's reported that sometimes a zcrx request can receive more than was
> requested. It's caused by io_zcrx_recv_skb() adjusting desc->count for
> all received buffers including frag lists, but then doing recursive
> calls to process frag list skbs, which leads to desc->count double
> accounting and underflow.
>
>
> [...]
Applied, thanks!
[1/1] io_uring/zcrx: fix overshooting recv limit
commit: 09cfd3c52ea76f43b3cb15e570aeddf633d65e80
Best regards,
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-10-08 17:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-08 12:38 [PATCH 1/1] io_uring/zcrx: fix overshooting recv limit Pavel Begunkov
2025-10-08 17:32 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox