Skip to content

Commit 50bc142

Browse files
committed
net: move skb_gro_receive_list from udp to core
jira KERNEL-1052 cve CVE-2026-46300 Rebuild_History Non-Buildable kernel-5.14.0-687.10.1.el9_8 commit-author Felix Fietkau <nbd@nbd.name> commit 8928756 This helper function will be used for TCP fraglist GRO support Acked-by: Paolo Abeni <pabeni@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Felix Fietkau <nbd@nbd.name> Reviewed-by: David Ahern <dsahern@kernel.org> Reviewed-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com> (cherry picked from commit 8928756) Signed-off-by: Jonathan Maple <jmaple@ciq.com>
1 parent 1f99b8a commit 50bc142

3 files changed

Lines changed: 28 additions & 27 deletions

File tree

include/net/gro.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -419,6 +419,7 @@ static inline __wsum ip6_gro_compute_pseudo(struct sk_buff *skb, int proto)
419419
}
420420

421421
int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb);
422+
int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb);
422423

423424
/* Pass the currently batched GRO_NORMAL SKBs up to the stack. */
424425
static inline void gro_normal_list(struct napi_struct *napi)

net/core/gro.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,33 @@ int skb_gro_receive(struct sk_buff *p, struct sk_buff *skb)
231231
return 0;
232232
}
233233

234+
int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
235+
{
236+
if (unlikely(p->len + skb->len >= 65536))
237+
return -E2BIG;
238+
239+
if (NAPI_GRO_CB(p)->last == p)
240+
skb_shinfo(p)->frag_list = skb;
241+
else
242+
NAPI_GRO_CB(p)->last->next = skb;
243+
244+
skb_pull(skb, skb_gro_offset(skb));
245+
246+
NAPI_GRO_CB(p)->last = skb;
247+
NAPI_GRO_CB(p)->count++;
248+
p->data_len += skb->len;
249+
250+
/* sk ownership - if any - completely transferred to the aggregated packet */
251+
skb->destructor = NULL;
252+
skb->sk = NULL;
253+
p->truesize += skb->truesize;
254+
p->len += skb->len;
255+
256+
NAPI_GRO_CB(skb)->same_flow = 1;
257+
258+
return 0;
259+
}
260+
234261

235262
static void napi_gro_complete(struct napi_struct *napi, struct sk_buff *skb)
236263
{

net/ipv4/udp_offload.c

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -465,33 +465,6 @@ static struct sk_buff *udp4_ufo_fragment(struct sk_buff *skb,
465465
return segs;
466466
}
467467

468-
static int skb_gro_receive_list(struct sk_buff *p, struct sk_buff *skb)
469-
{
470-
if (unlikely(p->len + skb->len >= 65536))
471-
return -E2BIG;
472-
473-
if (NAPI_GRO_CB(p)->last == p)
474-
skb_shinfo(p)->frag_list = skb;
475-
else
476-
NAPI_GRO_CB(p)->last->next = skb;
477-
478-
skb_pull(skb, skb_gro_offset(skb));
479-
480-
NAPI_GRO_CB(p)->last = skb;
481-
NAPI_GRO_CB(p)->count++;
482-
p->data_len += skb->len;
483-
484-
/* sk ownership - if any - completely transferred to the aggregated packet */
485-
skb->destructor = NULL;
486-
skb->sk = NULL;
487-
p->truesize += skb->truesize;
488-
p->len += skb->len;
489-
490-
NAPI_GRO_CB(skb)->same_flow = 1;
491-
492-
return 0;
493-
}
494-
495468

496469
#define UDP_GRO_CNT_MAX 64
497470
static struct sk_buff *udp_gro_receive_segment(struct list_head *head,

0 commit comments

Comments
 (0)