diff options
author | Thomas Graf <tgraf@redhat.com> | 2012-12-06 04:25:04 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2012-12-07 14:15:04 -0500 |
commit | 0b0fe913bf6d551642eb8892ed90be7358906379 (patch) | |
tree | cd119f956cd2b9428a16836020a80772b877f18b /net/sctp/proc.c | |
parent | 36f0ffa59175883bf2b01b38a60384314368aae9 (diff) |
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 <vyasevich@gmail.com>
Cc: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: Thomas Graf <tgraf@suug.ch>
Acked-by: Vlad Yasevich <vyasevic@gmail.com>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/sctp/proc.c')
-rw-r--r-- | net/sctp/proc.c | 7 |
1 files changed, 6 insertions, 1 deletions
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 | |||
139 | primary = &peer->saddr; | 139 | primary = &peer->saddr; |
140 | } | 140 | } |
141 | 141 | ||
142 | list_for_each_entry(laddr, &epb->bind_addr.address_list, list) { | 142 | rcu_read_lock(); |
143 | list_for_each_entry_rcu(laddr, &epb->bind_addr.address_list, list) { | ||
144 | if (!laddr->valid) | ||
145 | continue; | ||
146 | |||
143 | addr = &laddr->a; | 147 | addr = &laddr->a; |
144 | af = sctp_get_af_specific(addr->sa.sa_family); | 148 | af = sctp_get_af_specific(addr->sa.sa_family); |
145 | if (primary && af->cmp_addr(addr, primary)) { | 149 | 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 | |||
147 | } | 151 | } |
148 | af->seq_dump_addr(seq, addr); | 152 | af->seq_dump_addr(seq, addr); |
149 | } | 153 | } |
154 | rcu_read_unlock(); | ||
150 | } | 155 | } |
151 | 156 | ||
152 | /* Dump remote addresses of an association. */ | 157 | /* Dump remote addresses of an association. */ |