Skip to content

Commit a05c1ed

Browse files
Shigeru Yoshidagregkh
authored andcommitted
ipv6: Fix potential uninit-value access in __ip6_make_skb()
commit 4e13d3a9c25b7080f8a619f961e943fe08c2672c upstream. As it was done in commit fc1092f51567 ("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: ea30388baebc ("ipv6: Fix an uninit variable access bug in __ip6_make_skb()") Signed-off-by: Shigeru Yoshida <[email protected]> Signed-off-by: David S. Miller <[email protected]> Signed-off-by: Zhaoyang Li <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent b7fd784 commit a05c1ed

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/ipv6/ip6_output.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1985,7 +1985,8 @@ struct sk_buff *__ip6_make_skb(struct sock *sk,
19851985
struct inet6_dev *idev = ip6_dst_idev(skb_dst(skb));
19861986
u8 icmp6_type;
19871987

1988-
if (sk->sk_socket->type == SOCK_RAW && !inet_sk(sk)->hdrincl)
1988+
if (sk->sk_socket->type == SOCK_RAW &&
1989+
!(fl6->flowi6_flags & FLOWI_FLAG_KNOWN_NH))
19891990
icmp6_type = fl6->fl6_icmp_type;
19901991
else
19911992
icmp6_type = icmp6_hdr(skb)->icmp6_type;

0 commit comments

Comments
 (0)