Kuniyuki Iwashima ca43ccf412 dccp/tcp: Avoid negative sk_forward_alloc by ipv6_pinfo.pktoptions.
Eric Dumazet pointed out [0] that when we call skb_set_owner_r()
for ipv6_pinfo.pktoptions, sk_rmem_schedule() has not been called,
resulting in a negative sk_forward_alloc.

We add a new helper which clones a skb and sets its owner only
when sk_rmem_schedule() succeeds.

Note that we move skb_set_owner_r() forward in (dccp|tcp)_v6_do_rcv()
because tcp_send_synack() can make sk_forward_alloc negative before
ipv6_opt_accepted() in the crossed SYN-ACK or self-connect() cases.

[0]: https://lore.kernel.org/netdev/CANn89iK9oc20Jdi_41jb9URdF210r7d1Y-+uypbMSbOfY6jqrg@mail.gmail.com/

Fixes: 323fbd0edf3f ("net: dccp: Add handling of IPV6_PKTOPTIONS to dccp_v6_do_rcv()")
Fixes: 3df80d9320bc ("[DCCP]: Introduce DCCPv6")
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2023-02-10 19:53:42 -08:00
..
2022-12-06 07:30:55 +09:00
2021-07-01 13:19:48 -07:00
2022-06-22 12:59:43 +01:00
2022-08-23 10:43:11 +02:00
2022-07-28 22:06:15 -07:00
2022-08-09 22:14:02 -07:00
2022-11-03 15:16:50 +01:00
2021-12-16 07:18:35 -08:00
2021-10-15 11:33:08 +01:00
2021-10-13 09:40:46 -07:00
2021-07-27 13:05:56 +01:00
2022-05-11 12:43:10 +01:00
2020-03-04 13:25:55 -08:00
2022-06-19 10:00:02 +01:00
2021-08-03 13:05:26 +01:00
2022-12-12 11:27:42 -08:00
2022-12-12 15:04:39 -08:00
2022-12-12 11:27:42 -08:00