]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.8/gro-fix-ownership-transfer.patch
6.8-stable patches
[thirdparty/kernel/stable-queue.git] / queue-6.8 / gro-fix-ownership-transfer.patch
1 From ed4cccef64c1d0d5b91e69f7a8a6697c3a865486 Mon Sep 17 00:00:00 2001
2 From: Antoine Tenart <atenart@kernel.org>
3 Date: Tue, 26 Mar 2024 12:33:59 +0100
4 Subject: gro: fix ownership transfer
5
6 From: Antoine Tenart <atenart@kernel.org>
7
8 commit ed4cccef64c1d0d5b91e69f7a8a6697c3a865486 upstream.
9
10 If packets are GROed with fraglist they might be segmented later on and
11 continue their journey in the stack. In skb_segment_list those skbs can
12 be reused as-is. This is an issue as their destructor was removed in
13 skb_gro_receive_list but not the reference to their socket, and then
14 they can't be orphaned. Fix this by also removing the reference to the
15 socket.
16
17 For example this could be observed,
18
19 kernel BUG at include/linux/skbuff.h:3131! (skb_orphan)
20 RIP: 0010:ip6_rcv_core+0x11bc/0x19a0
21 Call Trace:
22 ipv6_list_rcv+0x250/0x3f0
23 __netif_receive_skb_list_core+0x49d/0x8f0
24 netif_receive_skb_list_internal+0x634/0xd40
25 napi_complete_done+0x1d2/0x7d0
26 gro_cell_poll+0x118/0x1f0
27
28 A similar construction is found in skb_gro_receive, apply the same
29 change there.
30
31 Fixes: 5e10da5385d2 ("skbuff: allow 'slow_gro' for skb carring sock reference")
32 Signed-off-by: Antoine Tenart <atenart@kernel.org>
33 Reviewed-by: Willem de Bruijn <willemb@google.com>
34 Signed-off-by: David S. Miller <davem@davemloft.net>
35 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
36 ---
37 net/core/gro.c | 3 ++-
38 net/ipv4/udp_offload.c | 3 ++-
39 2 files changed, 4 insertions(+), 2 deletions(-)
40
41 --- a/net/core/gro.c
42 +++ b/net/core/gro.c
43 @@ -195,8 +195,9 @@ int skb_gro_receive(struct sk_buff *p, s
44 }
45
46 merge:
47 - /* sk owenrship - if any - completely transferred to the aggregated packet */
48 + /* sk ownership - if any - completely transferred to the aggregated packet */
49 skb->destructor = NULL;
50 + skb->sk = NULL;
51 delta_truesize = skb->truesize;
52 if (offset > headlen) {
53 unsigned int eat = offset - headlen;
54 --- a/net/ipv4/udp_offload.c
55 +++ b/net/ipv4/udp_offload.c
56 @@ -449,8 +449,9 @@ static int skb_gro_receive_list(struct s
57 NAPI_GRO_CB(p)->count++;
58 p->data_len += skb->len;
59
60 - /* sk owenrship - if any - completely transferred to the aggregated packet */
61 + /* sk ownership - if any - completely transferred to the aggregated packet */
62 skb->destructor = NULL;
63 + skb->sk = NULL;
64 p->truesize += skb->truesize;
65 p->len += skb->len;
66