]> git.baikalelectronics.ru Git - kernel.git/commit
ipv4: Fix potential uninit variable access bug in __ip_make_skb()
authorZiyang Xuan <william.xuanziyang@huawei.com>
Thu, 20 Apr 2023 12:40:35 +0000 (20:40 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 May 2023 09:35:45 +0000 (11:35 +0200)
commit729e0a1148201523454a7ae354b2a836d9c2f4f1
tree0c74accbc654a8c62610e94f5c7ffca4b2aa3e03
parent9de070954ed13f3e6ba421187f55ae220a9c3e46
ipv4: Fix potential uninit variable access bug in __ip_make_skb()

[ Upstream commit 99e5acae193e369b71217efe6f1dad42f3f18815 ]

Like commit ea30388baebc ("ipv6: Fix an uninit variable access bug in
__ip6_make_skb()"). icmphdr does not in skb linear region under the
scenario of SOCK_RAW socket. Access icmp_hdr(skb)->type directly will
trigger the uninit variable access bug.

Use a local variable icmp_type to carry the correct value in different
scenarios.

Fixes: 64f113617ce2 ("[IPV4]: Add ICMPMsgStats MIB (RFC 4293)")
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/ip_output.c