Skip to content

Commit

Permalink
sctp: proc: protect bind_addr->address_list accesses with rcu_read_lo…
Browse files Browse the repository at this point in the history
…ck()

address_list is protected via the socket lock or RCU. Since we don't want
to take the socket lock for each assoc we dump in procfs a RCU read-side
critical section must be entered.

V2: Skip local addresses marked as dead

Cc: Vlad Yasevich <[email protected]>
Cc: Neil Horman <[email protected]>
Signed-off-by: Thomas Graf <[email protected]>
Acked-by: Vlad Yasevich <[email protected]>
Acked-by: Neil Horman <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
Thomas Graf authored and davem330 committed Dec 7, 2012
1 parent 36f0ffa commit 0b0fe91
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion net/sctp/proc.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,14 +139,19 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo
primary = &peer->saddr;
}

list_for_each_entry(laddr, &epb->bind_addr.address_list, list) {
rcu_read_lock();
list_for_each_entry_rcu(laddr, &epb->bind_addr.address_list, list) {
if (!laddr->valid)
continue;

addr = &laddr->a;
af = sctp_get_af_specific(addr->sa.sa_family);
if (primary && af->cmp_addr(addr, primary)) {
seq_printf(seq, "*");
}
af->seq_dump_addr(seq, addr);
}
rcu_read_unlock();
}

/* Dump remote addresses of an association. */
Expand Down

0 comments on commit 0b0fe91

Please sign in to comment.