Skip to content
Commit 957d761c authored by Alexey Kodanev's avatar Alexey Kodanev Committed by David S. Miller
Browse files

sctp: fix dst refcnt leak in sctp_v6_get_dst()



When going through the bind address list in sctp_v6_get_dst() and
the previously found address is better ('matchlen > bmatchlen'),
the code continues to the next iteration without releasing currently
held destination.

Fix it by releasing 'bdst' before continue to the next iteration, and
instead of introducing one more '!IS_ERR(bdst)' check for dst_release(),
move the already existed one right after ip6_dst_lookup_flow(), i.e. we
shouldn't proceed further if we get an error for the route lookup.

Fixes: dbc2b5e9 ("sctp: fix src address selection if using secondary addresses for ipv6")
Signed-off-by: default avatarAlexey Kodanev <alexey.kodanev@oracle.com>
Acked-by: default avatarNeil Horman <nhorman@tuxdriver.com>
Acked-by: default avatarMarcelo Ricardo Leitner <marcelo.leitner@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 23ddd261
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