Skip to content

Commit

Permalink
l2tp: take a reference for kernel sockets in l2tp_tunnel_sock_lookup
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Tom Parkin authored and David S. Miller committed Mar 20, 2013
1 parent 2b551c6 commit 8abbbe8
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/l2tp/l2tp_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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);

Expand Down

0 comments on commit 8abbbe8

Please sign in to comment.