summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-10-14 09:03:34 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2024-10-14 09:03:34 +0200
commitbebb45743d52fea1ac0a4a9f465f11d11e885f40 (patch)
treea1dda3e26ac754e78cbb9734dae3f13f3a8adf39 /net/socket.c
parentea7f2dfd13e096dce3198e5ffdb00d21bf7c8fe5 (diff)
parent8e929cb546ee42c9a61d24fae60605e9e3192354 (diff)
Merge tag 'v6.12-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux into gpio/for-next
Linux 6.12-rc3
Diffstat (limited to 'net/socket.c')
-rw-r--r--net/socket.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/net/socket.c b/net/socket.c
index 601ad74930ef..042451f01c65 100644
--- a/net/socket.c
+++ b/net/socket.c
@@ -1574,8 +1574,13 @@ int __sock_create(struct net *net, int family, int type, int protocol,
rcu_read_unlock();
err = pf->create(net, sock, protocol, kern);
- if (err < 0)
+ if (err < 0) {
+ /* ->create should release the allocated sock->sk object on error
+ * but it may leave the dangling pointer
+ */
+ sock->sk = NULL;
goto out_module_put;
+ }
/*
* Now to bump the refcnt of the [loadable] module that owns this