[PATCH net-next 02/17] Allocate and free cork for ipv4 and ipv6

From: Oliver Crumrine
Date: Sun Oct 22 2023 - 12:20:19 EST


This allocates the cork for ipv4, and frees it for both ipv4 and ipv6
(ipv6 inet_cork_full is allocated in a different function)

Signed-off-by: Oliver Crumrine <ozlinuxc@xxxxxxxxx>
---
net/ipv4/af_inet.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/net/ipv4/af_inet.c b/net/ipv4/af_inet.c
index 2713c9b06c4c..3edfd8737715 100644
--- a/net/ipv4/af_inet.c
+++ b/net/ipv4/af_inet.c
@@ -362,6 +362,7 @@ static int inet_create(struct net *net, struct socket *sock, int protocol,
inet->mc_index = 0;
inet->mc_list = NULL;
inet->rcv_tos = 0;
+ inet->cork = kzalloc(sizeof(struct inet_cork_full), GFP_KERNEL);

if (inet->inet_num) {
/* It assumes that any protocol which allows
@@ -431,6 +432,7 @@ int inet_release(struct socket *sock)
!(current->flags & PF_EXITING))
timeout = sk->sk_lingertime;
sk->sk_prot->close(sk, timeout);
+ kfree(inet_sk(sk)->cork);
sock->sk = NULL;
}
return 0;
--
2.42.0