diff options
-rw-r--r-- | net/tipc/udp_media.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/tipc/udp_media.c b/net/tipc/udp_media.c index 6fe8740a226f..fb2f7ec68eef 100644 --- a/net/tipc/udp_media.c +++ b/net/tipc/udp_media.c @@ -310,9 +310,14 @@ err: #if IS_ENABLED(CONFIG_IPV6) } else if ((sa_local.ss_family & sa_remote.ss_family) == AF_INET6) { + int atype; struct sockaddr_in6 *ip6; ip6 = (struct sockaddr_in6 *)&sa_local; + atype = ipv6_addr_type(&ip6->sin6_addr); + if (__ipv6_addr_needs_scope_id(atype) && !ip6->sin6_scope_id) + return -EINVAL; + local->proto = htons(ETH_P_IPV6); local->udp_port = ip6->sin6_port; memcpy(&local->ipv6, &ip6->sin6_addr, sizeof(struct in6_addr)); |