Commit 8abbbe8f authored by Tom Parkin's avatar Tom Parkin Committed by David S. Miller

l2tp: take a reference for kernel sockets in l2tp_tunnel_sock_lookup

When looking up the tunnel socket in struct l2tp_tunnel, hold a reference
whether the socket was created by the kernel or by userspace.
Signed-off-by: default avatarTom Parkin <tparkin@katalix.com>
Signed-off-by: default avatarJames Chapman <jchapman@katalix.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 2b551c6e
...@@ -191,6 +191,7 @@ struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel) ...@@ -191,6 +191,7 @@ struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel)
} else { } else {
/* Socket is owned by kernelspace */ /* Socket is owned by kernelspace */
sk = tunnel->sock; sk = tunnel->sock;
sock_hold(sk);
} }
out: out:
...@@ -209,6 +210,7 @@ void l2tp_tunnel_sock_put(struct sock *sk) ...@@ -209,6 +210,7 @@ void l2tp_tunnel_sock_put(struct sock *sk)
} }
sock_put(sk); sock_put(sk);
} }
sock_put(sk);
} }
EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put); EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment