mirror of
https://github.com/freebsd/freebsd-src.git
synced 2026-10-28 11:25:21 +01:00
ng_socket: plug node reference leak
There is no need to reference node in its constructor, the framework
already granted us a reference. This extraneous reference was later given
back on socket detach. However, if node is destroyed before the socket,
the node was leaked. This leak was harmless until VIMAGE, where
vnet_netgraph_uninit() would cycle through all nodes and shut them down
expecting them to not exist after the shutdown.
Fixes: 1928437497
This commit is contained in:
1 parent
41bc52c893
commit
4d3cbeb7b4
1 file changed
-2
@@ -506,7 +506,6 @@ ngc_attach(struct socket *so, int type, struct thread *td)
|
||||
|
||||
/* Link the node and the private data. */
|
||||
NG_NODE_SET_PRIVATE(priv->node, priv);
|
||||
NG_NODE_REF(priv->node);
|
||||
priv->refs++;
|
||||
|
||||
return (0);
|
||||
@@ -602,7 +601,6 @@ ng_socket_free_priv(struct ngsock *priv)
|
||||
|
||||
priv->node = NULL;
|
||||
mtx_unlock(&priv->mtx);
|
||||
NG_NODE_UNREF(node);
|
||||
ng_rmnode_self(node);
|
||||
} else
|
||||
mtx_unlock(&priv->mtx);
|
||||
|
||||
Reference in new issue
Block a user