Netdev List
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Simon Horman <horms@kernel.org>, Ido Schimmel <idosch@nvidia.com>,
	David Ahern <dsahern@kernel.org>,
	netdev@vger.kernel.org, eric.dumazet@gmail.com,
	syzbot+6d2762674103618994b0@syzkaller.appspotmail.com,
	Peilin He <he.peilin@zte.com.cn>, xu xin <xu.xin16@zte.com.cn>
Subject: Re: [PATCH net] net: icmp: avoid invalid transport header access in icmp_send tracepoint
Date: Tue, 25 Aug 2026 08:50:52 -0400	[thread overview]
Message-ID: <20260825085052.72ce4878@gandalf.local.home> (raw)
In-Reply-To: <20260825084551.1562967-1-edumazet@google.com>

On Tue, 25 Aug 2026 08:45:51 +0000
Eric Dumazet <edumazet@google.com> wrote:

> diff --git a/include/trace/events/icmp.h b/include/trace/events/icmp.h
> index 09ae115099dfe25616b6c74d5b92be1af4acff55..6937b778ae54dbf4442b127957a017da3551aaff 100644
> --- a/include/trace/events/icmp.h
> +++ b/include/trace/events/icmp.h
> @@ -27,17 +27,20 @@ TRACE_EVENT(icmp_send,
>  
>  		TP_fast_assign(
>  			struct iphdr *iph = ip_hdr(skb);
> -			struct udphdr *uh = udp_hdr(skb);
> -			int proto_4 = iph->protocol;
> +			struct udphdr _uh, *uh = NULL;
>  			__be32 *p32;
>  
>  			__entry->skbaddr = skb;
>  			__entry->type = type;
>  			__entry->code = code;
>  
> -			if (proto_4 != IPPROTO_UDP || (u8 *)uh < skb->head ||
> -				(u8 *)uh + sizeof(struct udphdr)
> -				> skb_tail_pointer(skb)) {  
> +			if (iph->protocol == IPPROTO_UDP)
> +				uh = skb_header_pointer(skb,
> +							skb_network_offset(skb) +
> +							(iph->ihl << 2),
> +							sizeof(_uh), &_uh);

I don't know if networking has different rules about this, but we usually
suggest using brackets around the if block for any multi line code. Not
just multi commands. If the line needs to be broken due to length, we
suggest brackets.

-- Steve


> +
> +			if (!uh) {
>  				__entry->sport = 0;
>  				__entry->dport = 0;
>  				__entry->ulen = 0;


  parent reply	other threads:[~2026-08-25 12:50 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-25  8:45 [PATCH net] net: icmp: avoid invalid transport header access in icmp_send tracepoint Eric Dumazet
2026-08-25  9:43 ` Jiayuan Chen
2026-08-25 12:50 ` Steven Rostedt [this message]
2026-08-25 14:11   ` Eric Dumazet
2026-08-25 14:48 ` David Ahern
2026-08-28 22:10 ` patchwork-bot+netdevbpf

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260825085052.72ce4878@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=eric.dumazet@gmail.com \
    --cc=he.peilin@zte.com.cn \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=syzbot+6d2762674103618994b0@syzkaller.appspotmail.com \
    --cc=xu.xin16@zte.com.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox