linux-imx/include/net/sctp
Jason Gunthorpe 43da4014d8 sctp: Fix mangled IPv4 addresses on a IPv6 listening socket
commit 9302d7bb0c upstream.

sctp_v4_map_v6 was subtly writing and reading from members
of a union in a way the clobbered data it needed to read before
it read it.

Zeroing the v6 flowinfo overwrites the v4 sin_addr with 0, meaning
that every place that calls sctp_v4_map_v6 gets ::ffff:0.0.0.0 as the
result.

Reorder things to guarantee correct behaviour no matter what the
union layout is.

This impacts user space clients that open an IPv6 SCTP socket and
receive IPv4 connections. Prior to 299ee user space would see a
sockaddr with AF_INET and a correct address, after 299ee the sockaddr
is AF_INET6, but the address is wrong.

Fixes: 299ee123e1 (sctp: Fixup v4mapped behaviour to comply with Sock API)
Signed-off-by: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
2018-06-01 00:30:00 +01:00
..
auth.h [SCTP]: Stop claiming that this is a "reference implementation" 2008-02-05 10:59:07 -05:00
checksum.h sctp: Clean up sctp checksumming code 2009-02-16 00:03:10 -08:00
command.h sctp: deal with multiple COOKIE_ECHO chunks 2011-09-16 17:17:22 -04:00
constants.h sctp: remove completely unsed EMPTY state 2011-04-20 01:51:03 -07:00
sctp.h sctp: Fix mangled IPv4 addresses on a IPv6 listening socket 2018-06-01 00:30:00 +01:00
sm.h net: sctp: fix skb_over_panic when receiving malformed ASCONF chunks 2014-11-05 20:27:48 +00:00
structs.h sctp: Fixup v4mapped behaviour to comply with Sock API 2018-02-13 18:32:16 +00:00
tsnmap.h net: return operator cleanup 2010-09-23 14:33:39 -07:00
ulpevent.h sctp: ABORT if receive, reassmbly, or reodering queue is not empty while closing socket 2011-07-08 09:53:08 -07:00
ulpqueue.h [SCTP]: Stop claiming that this is a "reference implementation" 2008-02-05 10:59:07 -05:00
user.h sctp: Add socket option operation for Auto-ASCONF. 2011-06-02 02:04:53 -07:00