diff options
author | Xin Long <lucien.xin@gmail.com> | 2016-02-27 21:33:11 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-03-01 17:35:44 -0500 |
commit | 3d73e8fac8f84942f15307d6d9cb1dba843d3fb2 (patch) | |
tree | 3daec4bf3762a03bff5e719708544d288db36942 /net | |
parent | 40b4f0fd74e46c017814618d67ec9127ff20f157 (diff) |
sctp: sctp_remaddr_seq_show use the wrong variable to dump transport info
Now in sctp_remaddr_seq_show(), we use variable *tsp to get the param *v.
but *tsp is also used to traversal transport_addr_list, which will cover
the previous value, and make sctp_transport_put work on the wrong transport.
So fix it by adding a new variable to get the param *v.
Fixes: fba4c330c5b9 ("sctp: hold transport before we access t->asoc in sctp proc")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/sctp/proc.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/net/sctp/proc.c b/net/sctp/proc.c index ded7d931a6a5..963dffcc2618 100644 --- a/net/sctp/proc.c +++ b/net/sctp/proc.c | |||
@@ -482,7 +482,7 @@ static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v) | |||
482 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | 482 | static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) |
483 | { | 483 | { |
484 | struct sctp_association *assoc; | 484 | struct sctp_association *assoc; |
485 | struct sctp_transport *tsp; | 485 | struct sctp_transport *transport, *tsp; |
486 | 486 | ||
487 | if (v == SEQ_START_TOKEN) { | 487 | if (v == SEQ_START_TOKEN) { |
488 | seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX " | 488 | seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX " |
@@ -490,10 +490,10 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | |||
490 | return 0; | 490 | return 0; |
491 | } | 491 | } |
492 | 492 | ||
493 | tsp = (struct sctp_transport *)v; | 493 | transport = (struct sctp_transport *)v; |
494 | if (!sctp_transport_hold(tsp)) | 494 | if (!sctp_transport_hold(transport)) |
495 | return 0; | 495 | return 0; |
496 | assoc = tsp->asoc; | 496 | assoc = transport->asoc; |
497 | 497 | ||
498 | list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, | 498 | list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, |
499 | transports) { | 499 | transports) { |
@@ -546,7 +546,7 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) | |||
546 | seq_printf(seq, "\n"); | 546 | seq_printf(seq, "\n"); |
547 | } | 547 | } |
548 | 548 | ||
549 | sctp_transport_put(tsp); | 549 | sctp_transport_put(transport); |
550 | 550 | ||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |