History

io_uring/zcrx: fix overshooting recv limit

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.

Pavel Begunkov committed 1 year ago

Commit 09cfd3c1 parent beb97991 file · +4 −0Browse files

Unified · Split

io_uring/zcrx.c+4−0
@@ -1236,12 +1236,16 @@ io_zcrx_recv_skb(read_descriptor_t *desc, struct sk_buff *skb, · 1235 unmodified lines
12361236
12371237 end = start + frag_iter->len;
12381238 if (offset < end) {
1239+ size_t count;
1240+
12391241 copy = end - offset;
12401242 if (copy > len)
12411243 copy = len;
12421244
12431245 off = offset - start;
1246+ count = desc->count;
12441247 ret = io_zcrx_recv_skb(desc, frag_iter, off, copy);
1248+ desc->count = count;
12451249 if (ret < 0)
12461250 goto out;
12471251