mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-21 01:51:18 +00:00
ipv6: fix restrict IPV6_ADDRFORM operation
[ Upstream commit82c9ae4408
] Commitb6f6118901
("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:b6f6118901
("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>
This commit is contained in:
parent
382f57b996
commit
2d197d8e1a
1 changed files with 6 additions and 7 deletions
|
@ -183,15 +183,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
|
|||
retv = -EBUSY;
|
||||
break;
|
||||
}
|
||||
} else if (sk->sk_protocol == IPPROTO_TCP) {
|
||||
if (sk->sk_prot != &tcpv6_prot) {
|
||||
retv = -EBUSY;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
}
|
||||
if (sk->sk_protocol == IPPROTO_TCP &&
|
||||
sk->sk_prot != &tcpv6_prot) {
|
||||
retv = -EBUSY;
|
||||
break;
|
||||
}
|
||||
if (sk->sk_protocol != IPPROTO_TCP)
|
||||
break;
|
||||
if (sk->sk_state != TCP_ESTABLISHED) {
|
||||
retv = -ENOTCONN;
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue