summaryrefslogtreecommitdiff
path: root/net/sctp/proc.c
diff options
context:
space:
mode:
authorXin Long <lucien.xin@gmail.com>2018-08-27 18:38:31 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-09-15 09:45:25 +0200
commit3c035a48e7746d2b6f76719376473ad5d12e423a (patch)
tree2c08fe974159a122c0fb14232c0d14dee0c71ed8 /net/sctp/proc.c
parent456e46f05b37e016628c07fa5e63ec42749d13d3 (diff)
sctp: hold transport before accessing its asoc in sctp_transport_get_next
[ Upstream commit bab1be79a5169ac748d8292b20c86d874022d7ba ] As Marcelo noticed, in sctp_transport_get_next, it is iterating over transports but then also accessing the association directly, without checking any refcnts before that, which can cause an use-after-free Read. So fix it by holding transport before accessing the association. With that, sctp_transport_hold calls can be removed in the later places. Fixes: 626d16f50f39 ("sctp: export some apis or variables for sctp_diag and reuse some for proc") Reported-by: syzbot+fe62a0c9aa6a85c6de16@syzkaller.appspotmail.com Signed-off-by: Xin Long <lucien.xin@gmail.com> Acked-by: Neil Horman <nhorman@tuxdriver.com> Acked-by: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/sctp/proc.c')
-rw-r--r--net/sctp/proc.c4
1 files changed, 0 insertions, 4 deletions
diff --git a/net/sctp/proc.c b/net/sctp/proc.c
index 26b4be6b4172..6c82a959fc6e 100644
--- a/net/sctp/proc.c
+++ b/net/sctp/proc.c
@@ -335,8 +335,6 @@ static int sctp_assocs_seq_show(struct seq_file *seq, void *v)
}
transport = (struct sctp_transport *)v;
- if (!sctp_transport_hold(transport))
- return 0;
assoc = transport->asoc;
epb = &assoc->base;
sk = epb->sk;
@@ -426,8 +424,6 @@ static int sctp_remaddr_seq_show(struct seq_file *seq, void *v)
}
transport = (struct sctp_transport *)v;
- if (!sctp_transport_hold(transport))
- return 0;
assoc = transport->asoc;
list_for_each_entry_rcu(tsp, &assoc->peer.transport_addr_list,