From: Simon Horman <horms@kernel.org>
To: Xuanqiang Luo <xuanqiang.luo@linux.dev>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
Emil Tsalapatis <emil@etsalapatis.com>,
Ihor Solodrai <ihor.solodrai@linux.dev>,
Matthieu Baerts <matttbe@kernel.org>,
Mat Martineau <martineau@kernel.org>,
Geliang Tang <geliang@kernel.org>,
David Ahern <dsahern@kernel.org>,
Ido Schimmel <idosch@nvidia.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Neal Cardwell <ncardwell@google.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Pablo Neira Ayuso <pablo@netfilter.org>,
Florian Westphal <fw@strlen.de>, Phil Sutter <phil@nwl.cc>,
bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
mptcp@lists.linux.dev, netfilter-devel@vger.kernel.org,
coreteam@netfilter.org, Xuanqiang Luo <luoxuanqiang@kylinos.cn>
Subject: Re: [PATCH net-next v1 3/6] ipv4: raw: do not use skb_header_pointer() in icmp_filter()
Date: Fri, 4 Dec 2026 17:04:52 +0000 [thread overview]
Message-ID: <20261204170452.GB192805@horms.kernel.org> (raw)
In-Reply-To: <20261124130631.1886963-4-xuanqiang.luo@linux.dev>
On Tue, Nov 24, 2026 at 10:06:28PM +0900, Xuanqiang Luo wrote:
...
> @@ -166,10 +164,10 @@ static int icmp_filter(const struct sock *sk, const struct sk_buff *skb)
> * RFC 1122: SHOULD pass TOS value up to the transport layer.
> * -> It does. And not only TOS, but all IP header.
> */
> -static int raw_v4_input(struct net *net, struct sk_buff *skb,
> - const struct iphdr *iph, int hash)
> +static int raw_v4_input(struct net *net, struct sk_buff *skb, int hash)
> {
> int sdif = inet_sdif(skb);
> + const struct iphdr *iph;
> struct hlist_head *hlist;
> int dif = inet_iif(skb);
> int delivered = 0;
nit: If you have to respin this patchset for some other reason then
please preserve reverse xmas tree - longest line to shortest - order
for local variable declarations.
> @@ -178,13 +176,19 @@ static int raw_v4_input(struct net *net, struct sk_buff *skb,
> hlist = &raw_v4_hashinfo.ht[hash];
> rcu_read_lock();
> sk_for_each_rcu(sk, hlist) {
> + iph = ip_hdr(skb);
FWIIW, I would lean towards declaring iph in this scope.
> if (!raw_v4_match(net, sk, iph->protocol,
> iph->saddr, iph->daddr, dif, sdif))
> continue;
>
> delivered = 1;
> - if ((iph->protocol != IPPROTO_ICMP || !icmp_filter(sk, skb)) &&
> - ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
> + if (iph->protocol == IPPROTO_ICMP) {
> + if (icmp_filter(sk, skb))
> + continue;
> + /* icmp_filter() might have changed skb->head. */
> + iph = ip_hdr(skb);
> + }
> + if (ip_mc_sf_allow(sk, iph->daddr, iph->saddr,
> skb->dev->ifindex, sdif)) {
> struct sk_buff *clone;
>
> @@ -208,8 +212,7 @@ int raw_local_deliver(struct sk_buff *skb, int protocol)
> {
> struct net *net = dev_net(skb->dev);
>
> - return raw_v4_input(net, skb, ip_hdr(skb),
> - raw_hashfunc(net, protocol));
> + return raw_v4_input(net, skb, raw_hashfunc(net, protocol));
> }
>
> static void raw_err(struct sock *sk, struct sk_buff *skb, u32 info)
> --
> 2.43.0
>
next prev parent reply other threads:[~2026-12-04 17:05 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:06 [PATCH net-next v1 0/6] net: avoid stack canaries in TCP/IPv4 fast paths Xuanqiang Luo
2026-11-24 13:06 ` [PATCH net-next v1 1/6] tcp: avoid a stack canary in __tcp_select_window() Xuanqiang Luo
2026-11-24 13:06 ` [PATCH net-next v1 2/6] ipv4: avoid a stack canary in ip_finish_output2() Xuanqiang Luo
2026-11-24 13:06 ` [PATCH net-next v1 3/6] ipv4: raw: do not use skb_header_pointer() in icmp_filter() Xuanqiang Luo
2026-12-04 17:04 ` Simon Horman [this message]
2026-11-24 13:06 ` [PATCH net-next v1 4/6] net: avoid stack canaries in skb_try_coalesce() callers Xuanqiang Luo
2026-11-24 13:06 ` [PATCH net-next v1 5/6] tcp: avoid a stack canary in tcp_rcv_established() Xuanqiang Luo
2026-11-24 13:06 ` [PATCH net-next v1 6/6] tcp: do not call bpf_skops_write_hdr_opt() unless needed Xuanqiang Luo
2026-11-26 8:48 ` [PATCH net-next v1 0/6] net: avoid stack canaries in TCP/IPv4 fast paths gang.yan
2026-11-27 6:18 ` Xuanqiang Luo
2026-11-26 10:20 ` David Laight
2026-11-27 6:33 ` Xuanqiang Luo
2026-11-27 10:41 ` David Laight
2026-12-04 17:02 ` Simon Horman
2026-12-04 21:23 ` David Laight
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=20261204170452.GB192805@horms.kernel.org \
--to=horms@kernel.org \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=coreteam@netfilter.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=eddyz87@gmail.com \
--cc=edumazet@kernel.org \
--cc=emil@etsalapatis.com \
--cc=fw@strlen.de \
--cc=geliang@kernel.org \
--cc=idosch@nvidia.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luoxuanqiang@kylinos.cn \
--cc=martin.lau@linux.dev \
--cc=martineau@kernel.org \
--cc=matttbe@kernel.org \
--cc=memxor@gmail.com \
--cc=mptcp@lists.linux.dev \
--cc=ncardwell@google.com \
--cc=netdev@vger.kernel.org \
--cc=netfilter-devel@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pablo@netfilter.org \
--cc=phil@nwl.cc \
--cc=sdf@fomichev.me \
--cc=song@kernel.org \
--cc=xuanqiang.luo@linux.dev \
--cc=yonghong.song@linux.dev \
/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