aboutsummaryrefslogtreecommitdiffstats
path: root/net/l2tp
diff options
context:
space:
mode:
Diffstat (limited to 'net/l2tp')
-rw-r--r--net/l2tp/l2tp_core.c12
-rw-r--r--net/l2tp/l2tp_ip.c3
-rw-r--r--net/l2tp/l2tp_ip6.c3
3 files changed, 6 insertions, 12 deletions
diff --git a/net/l2tp/l2tp_core.c b/net/l2tp/l2tp_core.c
index dcfd64e83ab7..d36875f3427e 100644
--- a/net/l2tp/l2tp_core.c
+++ b/net/l2tp/l2tp_core.c
@@ -221,10 +221,9 @@ static struct l2tp_session *l2tp_session_find_2(struct net *net, u32 session_id)
221 struct hlist_head *session_list = 221 struct hlist_head *session_list =
222 l2tp_session_id_hash_2(pn, session_id); 222 l2tp_session_id_hash_2(pn, session_id);
223 struct l2tp_session *session; 223 struct l2tp_session *session;
224 struct hlist_node *walk;
225 224
226 rcu_read_lock_bh(); 225 rcu_read_lock_bh();
227 hlist_for_each_entry_rcu(session, walk, session_list, global_hlist) { 226 hlist_for_each_entry_rcu(session, session_list, global_hlist) {
228 if (session->session_id == session_id) { 227 if (session->session_id == session_id) {
229 rcu_read_unlock_bh(); 228 rcu_read_unlock_bh();
230 return session; 229 return session;
@@ -253,7 +252,6 @@ struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunn
253{ 252{
254 struct hlist_head *session_list; 253 struct hlist_head *session_list;
255 struct l2tp_session *session; 254 struct l2tp_session *session;
256 struct hlist_node *walk;
257 255
258 /* In L2TPv3, session_ids are unique over all tunnels and we 256 /* In L2TPv3, session_ids are unique over all tunnels and we
259 * sometimes need to look them up before we know the 257 * sometimes need to look them up before we know the
@@ -264,7 +262,7 @@ struct l2tp_session *l2tp_session_find(struct net *net, struct l2tp_tunnel *tunn
264 262
265 session_list = l2tp_session_id_hash(tunnel, session_id); 263 session_list = l2tp_session_id_hash(tunnel, session_id);
266 read_lock_bh(&tunnel->hlist_lock); 264 read_lock_bh(&tunnel->hlist_lock);
267 hlist_for_each_entry(session, walk, session_list, hlist) { 265 hlist_for_each_entry(session, session_list, hlist) {
268 if (session->session_id == session_id) { 266 if (session->session_id == session_id) {
269 read_unlock_bh(&tunnel->hlist_lock); 267 read_unlock_bh(&tunnel->hlist_lock);
270 return session; 268 return session;
@@ -279,13 +277,12 @@ EXPORT_SYMBOL_GPL(l2tp_session_find);
279struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth) 277struct l2tp_session *l2tp_session_find_nth(struct l2tp_tunnel *tunnel, int nth)
280{ 278{
281 int hash; 279 int hash;
282 struct hlist_node *walk;
283 struct l2tp_session *session; 280 struct l2tp_session *session;
284 int count = 0; 281 int count = 0;
285 282
286 read_lock_bh(&tunnel->hlist_lock); 283 read_lock_bh(&tunnel->hlist_lock);
287 for (hash = 0; hash < L2TP_HASH_SIZE; hash++) { 284 for (hash = 0; hash < L2TP_HASH_SIZE; hash++) {
288 hlist_for_each_entry(session, walk, &tunnel->session_hlist[hash], hlist) { 285 hlist_for_each_entry(session, &tunnel->session_hlist[hash], hlist) {
289 if (++count > nth) { 286 if (++count > nth) {
290 read_unlock_bh(&tunnel->hlist_lock); 287 read_unlock_bh(&tunnel->hlist_lock);
291 return session; 288 return session;
@@ -306,12 +303,11 @@ struct l2tp_session *l2tp_session_find_by_ifname(struct net *net, char *ifname)
306{ 303{
307 struct l2tp_net *pn = l2tp_pernet(net); 304 struct l2tp_net *pn = l2tp_pernet(net);
308 int hash; 305 int hash;
309 struct hlist_node *walk;
310 struct l2tp_session *session; 306 struct l2tp_session *session;
311 307
312 rcu_read_lock_bh(); 308 rcu_read_lock_bh();
313 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) { 309 for (hash = 0; hash < L2TP_HASH_SIZE_2; hash++) {
314 hlist_for_each_entry_rcu(session, walk, &pn->l2tp_session_hlist[hash], global_hlist) { 310 hlist_for_each_entry_rcu(session, &pn->l2tp_session_hlist[hash], global_hlist) {
315 if (!strcmp(session->ifname, ifname)) { 311 if (!strcmp(session->ifname, ifname)) {
316 rcu_read_unlock_bh(); 312 rcu_read_unlock_bh();
317 return session; 313 return session;
diff --git a/net/l2tp/l2tp_ip.c b/net/l2tp/l2tp_ip.c
index f7ac8f42fee2..7f41b7051269 100644
--- a/net/l2tp/l2tp_ip.c
+++ b/net/l2tp/l2tp_ip.c
@@ -49,10 +49,9 @@ static inline struct l2tp_ip_sock *l2tp_ip_sk(const struct sock *sk)
49 49
50static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id) 50static struct sock *__l2tp_ip_bind_lookup(struct net *net, __be32 laddr, int dif, u32 tunnel_id)
51{ 51{
52 struct hlist_node *node;
53 struct sock *sk; 52 struct sock *sk;
54 53
55 sk_for_each_bound(sk, node, &l2tp_ip_bind_table) { 54 sk_for_each_bound(sk, &l2tp_ip_bind_table) {
56 struct inet_sock *inet = inet_sk(sk); 55 struct inet_sock *inet = inet_sk(sk);
57 struct l2tp_ip_sock *l2tp = l2tp_ip_sk(sk); 56 struct l2tp_ip_sock *l2tp = l2tp_ip_sk(sk);
58 57
diff --git a/net/l2tp/l2tp_ip6.c b/net/l2tp/l2tp_ip6.c
index 8ee4a86ae996..41f2f8126ebc 100644
--- a/net/l2tp/l2tp_ip6.c
+++ b/net/l2tp/l2tp_ip6.c
@@ -60,10 +60,9 @@ static struct sock *__l2tp_ip6_bind_lookup(struct net *net,
60 struct in6_addr *laddr, 60 struct in6_addr *laddr,
61 int dif, u32 tunnel_id) 61 int dif, u32 tunnel_id)
62{ 62{
63 struct hlist_node *node;
64 struct sock *sk; 63 struct sock *sk;
65 64
66 sk_for_each_bound(sk, node, &l2tp_ip6_bind_table) { 65 sk_for_each_bound(sk, &l2tp_ip6_bind_table) {
67 struct in6_addr *addr = inet6_rcv_saddr(sk); 66 struct in6_addr *addr = inet6_rcv_saddr(sk);
68 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk); 67 struct l2tp_ip6_sock *l2tp = l2tp_ip6_sk(sk);
69 68