aboutsummaryrefslogtreecommitdiffstats
path: root/net/tipc/link.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/tipc/link.c')
-rw-r--r--net/tipc/link.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/tipc/link.c b/net/tipc/link.c
index 882c5c9c52f9..c5190ab75290 100644
--- a/net/tipc/link.c
+++ b/net/tipc/link.c
@@ -280,13 +280,13 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
280 return l_ptr; 280 return l_ptr;
281} 281}
282 282
283
284void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down) 283void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
285{ 284{
286 struct tipc_link *l_ptr; 285 struct tipc_link *l_ptr;
287 struct tipc_node *n_ptr; 286 struct tipc_node *n_ptr;
288 287
289 list_for_each_entry(n_ptr, &tipc_node_list, list) { 288 rcu_read_lock();
289 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
290 spin_lock_bh(&n_ptr->lock); 290 spin_lock_bh(&n_ptr->lock);
291 l_ptr = n_ptr->links[bearer_id]; 291 l_ptr = n_ptr->links[bearer_id];
292 if (l_ptr) { 292 if (l_ptr) {
@@ -309,6 +309,7 @@ void tipc_link_delete_list(unsigned int bearer_id, bool shutting_down)
309 } 309 }
310 spin_unlock_bh(&n_ptr->lock); 310 spin_unlock_bh(&n_ptr->lock);
311 } 311 }
312 rcu_read_unlock();
312} 313}
313 314
314/** 315/**
@@ -461,13 +462,15 @@ void tipc_link_reset_list(unsigned int bearer_id)
461 struct tipc_link *l_ptr; 462 struct tipc_link *l_ptr;
462 struct tipc_node *n_ptr; 463 struct tipc_node *n_ptr;
463 464
464 list_for_each_entry(n_ptr, &tipc_node_list, list) { 465 rcu_read_lock();
466 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
465 spin_lock_bh(&n_ptr->lock); 467 spin_lock_bh(&n_ptr->lock);
466 l_ptr = n_ptr->links[bearer_id]; 468 l_ptr = n_ptr->links[bearer_id];
467 if (l_ptr) 469 if (l_ptr)
468 tipc_link_reset(l_ptr); 470 tipc_link_reset(l_ptr);
469 spin_unlock_bh(&n_ptr->lock); 471 spin_unlock_bh(&n_ptr->lock);
470 } 472 }
473 rcu_read_unlock();
471} 474}
472 475
473static void link_activate(struct tipc_link *l_ptr) 476static void link_activate(struct tipc_link *l_ptr)
@@ -2404,13 +2407,12 @@ static struct tipc_node *tipc_link_find_owner(const char *link_name,
2404{ 2407{
2405 struct tipc_link *l_ptr; 2408 struct tipc_link *l_ptr;
2406 struct tipc_node *n_ptr; 2409 struct tipc_node *n_ptr;
2407 struct tipc_node *tmp_n_ptr;
2408 struct tipc_node *found_node = 0; 2410 struct tipc_node *found_node = 0;
2409
2410 int i; 2411 int i;
2411 2412
2412 *bearer_id = 0; 2413 *bearer_id = 0;
2413 list_for_each_entry_safe(n_ptr, tmp_n_ptr, &tipc_node_list, list) { 2414 rcu_read_lock();
2415 list_for_each_entry_rcu(n_ptr, &tipc_node_list, list) {
2414 tipc_node_lock(n_ptr); 2416 tipc_node_lock(n_ptr);
2415 for (i = 0; i < MAX_BEARERS; i++) { 2417 for (i = 0; i < MAX_BEARERS; i++) {
2416 l_ptr = n_ptr->links[i]; 2418 l_ptr = n_ptr->links[i];
@@ -2424,6 +2426,8 @@ static struct tipc_node *tipc_link_find_owner(const char *link_name,
2424 if (found_node) 2426 if (found_node)
2425 break; 2427 break;
2426 } 2428 }
2429 rcu_read_unlock();
2430
2427 return found_node; 2431 return found_node;
2428} 2432}
2429 2433