Revert "net: do not leave a dangling sk pointer, when socket creation fails"
authorIgnat Korchagin <ignat@cloudflare.com>
Mon, 14 Oct 2024 15:38:08 +0000 (16:38 +0100)
committerJakub Kicinski <kuba@kernel.org>
Wed, 16 Oct 2024 01:43:08 +0000 (18:43 -0700)
This reverts commit 6cd4a78d962bebbaf8beb7d2ead3f34120e3f7b2.

inet/inet6->create() implementations have been fixed to explicitly NULL the
allocated sk object on error.

A warning was put in place to make sure any future changes will not leave
a dangling pointer in pf->create() implementations.

So this code is now redundant.

Suggested-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Signed-off-by: Ignat Korchagin <ignat@cloudflare.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20241014153808.51894-10-ignat@cloudflare.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/core/sock.c

index f8c0d4e..756f8e8 100644 (file)
@@ -3827,9 +3827,6 @@ void sk_common_release(struct sock *sk)
 
        sk->sk_prot->unhash(sk);
 
-       if (sk->sk_socket)
-               sk->sk_socket->sk = NULL;
-
        /*
         * In this point socket cannot receive new packets, but it is possible
         * that some packets are in flight because some CPU runs receiver and