summaryrefslogtreecommitdiff
path: root/net/socket.c
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2024-11-04 14:44:16 +0100
committerMaarten Lankhorst <maarten.lankhorst@linux.intel.com>2024-11-04 14:45:21 +0100
commitd78f0ee0406803cda8801fd5201746ccf89e5e4a (patch)
treed0d145319344a07cb6f4b47578f01236b71ad473 /net/socket.c
parenta88f9ed63b3cec761b04cba8104b2d0b2b66b25d (diff)
parent30169bb64580bd7bce9290c1952bf0aa6cc37fe5 (diff)
Merge remote-tracking branch 'drm/drm-next' into drm-misc-next
Didn't notice drm/drm-next had the build fix for drm_bridge, so ended up committing the same patch. Sync with drm and pretend it didn't happen? Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
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