Commit 39940a48 authored by Al Viro's avatar Al Viro Committed by David S. Miller

[SCTP] bug: sctp_assoc_lookup_laddr() is broken with ipv6.

It expects (and gets) laddr with net-endian sin_port.  And then it calls
sctp_bind_addr_match(), which *does* care about port numbers in case of
ipv6 and expects them to be host-endian.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 04afd8b2
...@@ -1335,10 +1335,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc, ...@@ -1335,10 +1335,12 @@ int sctp_assoc_lookup_laddr(struct sctp_association *asoc,
const union sctp_addr *laddr) const union sctp_addr *laddr)
{ {
int found; int found;
union sctp_addr tmp;
flip_to_h(&tmp, laddr);
sctp_read_lock(&asoc->base.addr_lock); sctp_read_lock(&asoc->base.addr_lock);
if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) && if ((asoc->base.bind_addr.port == ntohs(laddr->v4.sin_port)) &&
sctp_bind_addr_match(&asoc->base.bind_addr, laddr, sctp_bind_addr_match(&asoc->base.bind_addr, &tmp,
sctp_sk(asoc->base.sk))) { sctp_sk(asoc->base.sk))) {
found = 1; found = 1;
goto out; goto out;
......
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