RE: [PATCH net v2] ipv4: Fix potential uninit variable access buf in __ip_make_skb()

Willem de Bruijn
2023-04-19T14:02:14Z

Ziyang Xuan wrote:
> 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: 96793b482540 ("[IPV4]: Add ICMPMsgStats MIB (RFC 4293)")
> Signed-off-by: Ziyang Xuan <william.xuanziyang@huawei.com>

Reviewed-by: Willem de Bruijn <willemb@google.com>