Commit 4e13d3a9 authored by Shigeru Yoshida's avatar Shigeru Yoshida Committed by David S. Miller

ipv6: Fix potential uninit-value access in __ip6_make_skb()

As it was done in commit fc1092f5 ("ipv4: Fix uninit-value access in
__ip_make_skb()") for IPv4, check FLOWI_FLAG_KNOWN_NH on fl6->flowi6_flags
instead of testing HDRINCL on the socket to avoid a race condition which
causes uninit-value access.

Fixes: ea30388b ("ipv6: Fix an uninit variable access bug in __ip6_make_skb()")
Signed-off-by: default avatarShigeru Yoshida <syoshida@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ab0cde32
...@@ -1933,7 +1933,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk, ...@@ -1933,7 +1933,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
u8 icmp6_type; u8 icmp6_type;
if (sk->sk_socket->type == SOCK_RAW && if (sk->sk_socket->type == SOCK_RAW &&
!inet_test_bit(HDRINCL, sk)) !(fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH))
icmp6_type = fl6->fl6_icmp_type; icmp6_type = fl6->fl6_icmp_type;
else else
icmp6_type = icmp6_hdr(skb)->icmp6_type; icmp6_type = icmp6_hdr(skb)->icmp6_type;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment