Unverified Commit 1c3dc6d9 authored by openeuler-ci-bot's avatar openeuler-ci-bot Committed by Gitee
Browse files

!12186 v2 ipv4: Fix uninit-value access in __ip_make_skb()

parents 277d45f0 14d7b07d
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -1571,7 +1571,8 @@ struct sk_buff *__ip_make_skb(struct sock *sk,
		 * so icmphdr does not in skb linear region and can not get icmp_type
		 * by icmp_hdr(skb)->type.
		 */
		if (sk->sk_type == SOCK_RAW && !inet_sk(sk)->hdrincl)
		if (sk->sk_type == SOCK_RAW &&
		    !(fl4->flowi4_flags & FLOWI_FLAG_KNOWN_NH))
			icmp_type = fl4->fl4_icmp_type;
		else
			icmp_type = icmp_hdr(skb)->type;
+3 −0
Original line number Diff line number Diff line
@@ -606,6 +606,9 @@ static int raw_sendmsg(struct sock *sk, struct msghdr *msg, size_t len)
			    (hdrincl ? FLOWI_FLAG_KNOWN_NH : 0),
			   daddr, saddr, 0, 0, sk->sk_uid);

	fl4.fl4_icmp_type = 0;
	fl4.fl4_icmp_code = 0;

	if (!hdrincl) {
		rfv.msg = msg;
		rfv.hlen = 0;