From: Daniel Borkmann <daniel@iogearbox.net>
To: David Laight <david.laight.linux@gmail.com>
Cc: kuba@kernel.org, edumazet@google.com, dsahern@kernel.org,
tom@herbertland.com, willemdebruijn.kernel@gmail.com,
idosch@nvidia.com, justin.iurman@gmail.com, pabeni@redhat.com,
netdev@vger.kernel.org
Subject: Re: [PATCH net v3] ipv6: Implement limits on extension header parsing
Date: Mon, 27 Apr 2026 15:30:32 +0200 [thread overview]
Message-ID: <b49fff96-f439-4cda-9f0e-82e148bfd454@iogearbox.net> (raw)
In-Reply-To: <20260427141449.4bc90a28@pumpkin>
On 4/27/26 3:14 PM, David Laight wrote:
> On Mon, 27 Apr 2026 12:13:18 +0200
> Daniel Borkmann <daniel@iogearbox.net> wrote:
[...]
>> ---
>> v2->v3:
>> - Adding IP6SKB_HOPBYHOP coverage (Justin)
>> - I left the limit at 8 w/ sysctl, still feels the better
>> option to me if we can keep the worst-case more tightened
>> v1->v2:
>> - Set the default to 8 (Justin)
>> - Update IETF references (Justin)
>> - Add core path coverage as well (Justin)
> ...
>> @@ -72,7 +74,9 @@ EXPORT_SYMBOL(ipv6_ext_hdr);
>> int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
>> __be16 *frag_offp)
>> {
>> + int exthdr_max = READ_ONCE(init_net.ipv6.sysctl.max_ext_hdrs_cnt);
>> u8 nexthdr = *nexthdrp;
>> + int exthdr_cnt = 0;
>>
>> *frag_offp = 0;
>>
>> @@ -82,6 +86,8 @@ int ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
>>
>> if (nexthdr == NEXTHDR_NONE)
>> return -1;
>> + if (unlikely(exthdr_cnt++ >= exthdr_max))
>> + return -1;
>
> It would be better to decrement the count and error at zero.
> if (unlikely(--exthdr_max < 0))
> return -1;
Well, its in the same style as the other existing gating counters, I'd
rather leave as-is rather than mixing inc/decs.
Thanks,
Daniel
next prev parent reply other threads:[~2026-04-27 13:30 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-27 10:13 [PATCH net v3] ipv6: Implement limits on extension header parsing Daniel Borkmann
2026-04-27 13:14 ` David Laight
2026-04-27 13:30 ` Daniel Borkmann [this message]
2026-04-27 20:14 ` Victor Nogueira
2026-04-28 6:02 ` kernel test robot
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=b49fff96-f439-4cda-9f0e-82e148bfd454@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=david.laight.linux@gmail.com \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=idosch@nvidia.com \
--cc=justin.iurman@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tom@herbertland.com \
--cc=willemdebruijn.kernel@gmail.com \
/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