aboutsummaryrefslogtreecommitdiffstats
path: root/net/sctp/associola.c
diff options
context:
space:
mode:
authorThomas Graf <tgraf@suug.ch>2012-12-06 04:25:05 -0500
committerDavid S. Miller <davem@davemloft.net>2012-12-07 14:15:04 -0500
commit45122ca26ced7fae41049326a3797a73f961db2e (patch)
tree347843ccf9b6a9eb9a4507e07b4c19faf0e59f70 /net/sctp/associola.c
parent0b0fe913bf6d551642eb8892ed90be7358906379 (diff)
sctp: Add RCU protection to assoc->transport_addr_list
peer.transport_addr_list is currently only protected by sk_sock which is inpractical to acquire for procfs dumping purposes. This patch adds RCU protection allowing for the procfs readers to enter RCU read-side critical sections. Modification of the list continues to be serialized via sk_lock. V2: Use list_del_rcu() in sctp_association_free() to be safe Skip transports marked dead when dumping for procfs Cc: Vlad Yasevich <vyasevich@gmail.com> Cc: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: Thomas Graf <tgraf@suug.ch> Acked-by: Vlad Yasevich <vyasevich@gmail.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/associola.c')
-rw-r--r--net/sctp/associola.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/sctp/associola.c b/net/sctp/associola.c
index ba3f9cc4c047..b45ed1f96921 100644
--- a/net/sctp/associola.c
+++ b/net/sctp/associola.c
@@ -448,7 +448,7 @@ void sctp_association_free(struct sctp_association *asoc)
448 /* Release the transport structures. */ 448 /* Release the transport structures. */
449 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) { 449 list_for_each_safe(pos, temp, &asoc->peer.transport_addr_list) {
450 transport = list_entry(pos, struct sctp_transport, transports); 450 transport = list_entry(pos, struct sctp_transport, transports);
451 list_del(pos); 451 list_del_rcu(pos);
452 sctp_transport_free(transport); 452 sctp_transport_free(transport);
453 } 453 }
454 454
@@ -568,7 +568,7 @@ void sctp_assoc_rm_peer(struct sctp_association *asoc,
568 sctp_assoc_update_retran_path(asoc); 568 sctp_assoc_update_retran_path(asoc);
569 569
570 /* Remove this peer from the list. */ 570 /* Remove this peer from the list. */
571 list_del(&peer->transports); 571 list_del_rcu(&peer->transports);
572 572
573 /* Get the first transport of asoc. */ 573 /* Get the first transport of asoc. */
574 pos = asoc->peer.transport_addr_list.next; 574 pos = asoc->peer.transport_addr_list.next;
@@ -769,7 +769,7 @@ struct sctp_transport *sctp_assoc_add_peer(struct sctp_association *asoc,
769 peer->state = peer_state; 769 peer->state = peer_state;
770 770
771 /* Attach the remote transport to our asoc. */ 771 /* Attach the remote transport to our asoc. */
772 list_add_tail(&peer->transports, &asoc->peer.transport_addr_list); 772 list_add_tail_rcu(&peer->transports, &asoc->peer.transport_addr_list);
773 asoc->peer.transport_count++; 773 asoc->peer.transport_count++;
774 774
775 /* If we do not yet have a primary path, set one. */ 775 /* If we do not yet have a primary path, set one. */