ipv6: fix restrict IPV6_ADDRFORM operation
authorJohn Haxby <john.haxby@oracle.com>
Sat, 18 Apr 2020 15:30:49 +0000 (16:30 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 2 May 2020 15:23:07 +0000 (17:23 +0200)
commita737ff38d8e575c054b3b6d6008ae6cfc0bd5800
treeba2fd07bdc6a61c0fe0ccd5af9b5508011ebba00
parent947a17f242ad3ac90cf4361d3b37b6ed5d35182c
ipv6: fix restrict IPV6_ADDRFORM operation

[ Upstream commit 82c9ae440857840c56e05d4fb1427ee032531346 ]

Commit b6f6118901d1 ("ipv6: restrict IPV6_ADDRFORM operation") fixed a
problem found by syzbot an unfortunate logic error meant that it
also broke IPV6_ADDRFORM.

Rearrange the checks so that the earlier test is just one of the series
of checks made before moving the socket from IPv6 to IPv4.

Fixes: b6f6118901d1 ("ipv6: restrict IPV6_ADDRFORM operation")
Signed-off-by: John Haxby <john.haxby@oracle.com>
Cc: stable@vger.kernel.org
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ipv6_sockglue.c