Commit 3d73e8fa authored by Xin Long's avatar Xin Long Committed by David S. Miller

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: fba4c330 ("sctp: hold transport before we access t->asoc in sctp proc")
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 40b4f0fd
...@@ -482,7 +482,7 @@ static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v) ...@@ -482,7 +482,7 @@ static void sctp_remaddr_seq_stop(struct seq_file *seq, void *v)
static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
{ {
struct sctp_association *assoc; struct sctp_association *assoc;
struct sctp_transport *tsp; struct sctp_transport *transport, *tsp;
if (v == SEQ_START_TOKEN) { if (v == SEQ_START_TOKEN) {
seq_printf(seq, "ADDR ASSOC_ID HB_ACT RTO MAX_PATH_RTX " 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,10 +490,10 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
return 0; return 0;
} }
tsp = (struct sctp_transport *)v; transport = (struct sctp_transport *)v;
if (!sctp_transport_hold(tsp)) if (!sctp_transport_hold(transport))
return 0; return 0;
assoc = tsp->asoc; assoc = transport->asoc;
list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list, list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list,
transports) { transports) {
...@@ -546,7 +546,7 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v) ...@@ -546,7 +546,7 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
seq_printf(seq, "\n"); seq_printf(seq, "\n");
} }
sctp_transport_put(tsp); sctp_transport_put(transport);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment