diff mbox series

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

Message ID ad861230877bd6d8b200aafde330c41afd67bd68.1697989543.git.ozlinuxc@gmail.com (mailing list archive)
State Rejected
Delegated to: Netdev Maintainers
Headers show
Series Change cork to a pointer in sockets | expand

Commit Message

Oliver Crumrine Oct. 22, 2023, 4:20 p.m. UTC
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@gmail.com>
---
 net/ipv4/af_inet.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

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;