From 0b0fe913bf6d551642eb8892ed90be7358906379 Mon Sep 17 00:00:00 2001 From: Thomas Graf Date: Thu, 6 Dec 2012 09:25:04 +0000 Subject: sctp: proc: protect bind_addr->address_list accesses with rcu_read_lock() 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 Cc: Neil Horman Signed-off-by: Thomas Graf Acked-by: Vlad Yasevich Acked-by: Neil Horman Signed-off-by: David S. Miller --- net/sctp/proc.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'net/sctp') diff --git a/net/sctp/proc.c b/net/sctp/proc.c index 9966e7b16451..06b05ee17d8d 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c @@ -139,7 +139,11 @@ 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)) { @@ -147,6 +151,7 @@ static void sctp_seq_dump_local_addrs(struct seq_file *seq, struct sctp_ep_commo } af->seq_dump_addr(seq, addr); } + rcu_read_unlock(); } /* Dump remote addresses of an association. */ -- cgit v1.2.2