Skip to content

Commit

Permalink
ipv6: Fix potential uninit-value access in __ip6_make_skb()
Browse files Browse the repository at this point in the history
As it was done in commit fc1092f ("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: ea30388 ("ipv6: Fix an uninit variable access bug in __ip6_make_skb()")
Signed-off-by: Shigeru Yoshida <syoshida@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Shigeru Yoshida authored and davem330 committed May 8, 2024
1 parent ab0cde3 commit 4e13d3a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv6/ip6_output.c
Original file line number Diff line number Diff line change
Expand Up @@ -1933,7 +1933,7 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
u8 icmp6_type;

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;
else
icmp6_type = icmp6_hdr(skb)->icmp6_type;
Expand Down

0 comments on commit 4e13d3a

Please sign in to comment.