Skip to content

Commit 9596cc8

Browse files
dlunevyoshfuji
authored andcommitted
[IPV6]: Do not change protocol for UDPv6 sockets with pending sent data.
Signed-off-by: Denis V. Lunev <[email protected]> Signed-off-by: YOSHIFUJI Hideaki <[email protected]>
1 parent 36d926b commit 9596cc8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

net/ipv6/ipv6_sockglue.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,14 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
164164
if (sk->sk_type == SOCK_RAW)
165165
break;
166166

167-
if (sk->sk_protocol != IPPROTO_UDP &&
168-
sk->sk_protocol != IPPROTO_UDPLITE &&
169-
sk->sk_protocol != IPPROTO_TCP)
167+
if (sk->sk_protocol == IPPROTO_UDP ||
168+
sk->sk_protocol == IPPROTO_UDPLITE) {
169+
struct udp_sock *up = udp_sk(sk);
170+
if (up->pending == AF_INET6) {
171+
retv = -EBUSY;
172+
break;
173+
}
174+
} else if (sk->sk_protocol != IPPROTO_TCP)
170175
break;
171176

172177
if (sk->sk_state != TCP_ESTABLISHED) {

0 commit comments

Comments
 (0)