From: Cong Wang Date: Sun, 2 Jun 2013 22:43:52 +0000 (+0000) Subject: ping: always initialize ->sin6_scope_id and ->sin6_flowinfo X-Git-Tag: Ubuntu-5.13.0-19.19~21882^2~188 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=c26d6b46da3ee86fa8a864347331e5513ca84c2b;p=mirror_ubuntu-jammy-kernel.git ping: always initialize ->sin6_scope_id and ->sin6_flowinfo If we don't need scope id, we should initialize it to zero. Same for ->sin6_flowinfo. Cc: Lorenzo Colitti Cc: David S. Miller Signed-off-by: Cong Wang Acked-by: Lorenzo Colitti Signed-off-by: David S. Miller --- diff --git a/net/ipv4/ping.c b/net/ipv4/ping.c index 3552a45a6f86..1f1b2dd90277 100644 --- a/net/ipv4/ping.c +++ b/net/ipv4/ping.c @@ -892,12 +892,12 @@ int ping_recvmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg, sin6->sin6_port = 0; sin6->sin6_addr = ip6->saddr; + sin6->sin6_flowinfo = 0; if (np->sndflow) sin6->sin6_flowinfo = ip6_flowinfo(ip6); - if (__ipv6_addr_needs_scope_id( - ipv6_addr_type(&sin6->sin6_addr))) - sin6->sin6_scope_id = IP6CB(skb)->iif; + sin6->sin6_scope_id = ipv6_iface_scope_id(&sin6->sin6_addr, + IP6CB(skb)->iif); if (inet6_sk(sk)->rxopt.all) pingv6_ops.ip6_datagram_recv_ctl(sk, msg, skb);