]> git.baikalelectronics.ru Git - kernel.git/commit
sctp: fix invalid reference to the index variable of the iterator
authorXin Long <lucien.xin@gmail.com>
Mon, 3 Sep 2018 07:47:10 +0000 (15:47 +0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 4 Sep 2018 04:57:54 +0000 (21:57 -0700)
commit8ac0eea86d532130b42ce97daefc63cc4c126162
treeb742478f7f6e75cfa5c4368a098474c4818c26e0
parent3b9407bb3e3972e23f5e237c73d5b96b9c7d930b
sctp: fix invalid reference to the index variable of the iterator

Now in sctp_apply_peer_addr_params(), if SPP_IPV6_FLOWLABEL flag is set
and trans is NULL, it would use trans as the index variable to traverse
transport_addr_list, then trans is set as the last transport of it.

Later, if SPP_DSCP flag is set, it would enter into the wrong branch as
trans is actually an invalid reference.

So fix it by using a new index variable to traverse transport_addr_list
for both SPP_DSCP and SPP_IPV6_FLOWLABEL flags process.

Fixes: d96ab52c5009 ("sctp: add spp_ipv6_flowlabel and spp_dscp for sctp_paddrparams")
Reported-by: Julia Lawall <julia.lawall@lip6.fr>
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/sctp/socket.c