summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorTom Parkin <tparkin@katalix.com>2013-03-19 07:11:17 +0100
committerDavid S. Miller <davem@davemloft.net>2013-03-20 17:10:38 +0100
commit8abbbe8ff572fd84d1b98eb9acf30611a97cf72e (patch)
treeb0ad882a2b2fca7777d01bbbe873da57e1c42609 /net
parentl2tp: close sessions before initiating tunnel delete (diff)
downloadlinux-8abbbe8ff572fd84d1b98eb9acf30611a97cf72e.tar.xz
linux-8abbbe8ff572fd84d1b98eb9acf30611a97cf72e.zip
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>
Diffstat (limited to 'net')
-rw-r--r--net/l2tp/l2tp_core.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index 0dd50c079f29..45373fee38c5 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -191,6 +191,7 @@ struct sock *l2tp_tunnel_sock_lookup(struct l2tp_tunnel *tunnel)
} else {
/* Socket is owned by kernelspace */
sk = tunnel->sock;
+ sock_hold(sk);
}
out:
@@ -209,6 +210,7 @@ void l2tp_tunnel_sock_put(struct sock *sk)
}
sock_put(sk);
}
+ sock_put(sk);
}
EXPORT_SYMBOL_GPL(l2tp_tunnel_sock_put);