mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-08-05 16:54:27 +00:00
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: Tom Parkin <tparkin@katalix.com> Signed-off-by: James Chapman <jchapman@katalix.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
parent
2b551c6e7d
commit
8abbbe8ff5
1 changed files with 2 additions and 0 deletions
|
@ -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)
|
||||||
}
|
}
|
||||||
sock_put(sk);
|
sock_put(sk);
|
||||||
}
|
}
|
||||||
|
sock_put(sk);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put);
|
EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue