summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShigeru Yoshida <syoshida@redhat.com>2024-05-06 17:11:29 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2024-05-17 13:14:53 +0300
commit2367bf254f3a27ecc6e229afd7a8b0a1395f7be3 (patch)
treeada39c6e9bec970e3a17db7491b405d4dc8c0dfe
parent2da5ccecef4b0c152c0516e7d48e195d51167b3c (diff)
downloadlinux-2367bf254f3a27ecc6e229afd7a8b0a1395f7be3.tar.xz
ipv6: Fix potential uninit-value access in __ip6_make_skb()
[ Upstream commit 4e13d3a9c25b7080f8a619f961e943fe08c2672c ] 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 <syoshida@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Sasha Levin <sashal@kernel.org>
-rw-r--r--net/ipv6/ip6_output.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv6/ip6_output.c b/net/ipv6/ip6_output.c
index 31b86fe661aa..568065a015c4 100644
--- a/net/ipv6/ip6_output.c
+++ b/net/ipv6/ip6_output.c
@@ -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;