All of lore.kernel.org
 help / color / mirror / Atom feed
From: Aaron Conole <aconole@redhat.com>
To: Ilya Maximets <i.maximets@ovn.org>
Cc: netdev@vger.kernel.org,  Eelco Chaudron <echaudro@redhat.com>,
	 "David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	 Paolo Abeni <pabeni@redhat.com>, Simon Horman <horms@kernel.org>,
	 Jiri Benc <jbenc@redhat.com>,  Yi Yang <yi.y.yang@intel.com>,
	 dev@openvswitch.org,  linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] net: nsh: fix incorrect header length macros
Date: Fri, 08 May 2026 08:50:35 -0400	[thread overview]
Message-ID: <f7ta4uarrok.fsf@redhat.com> (raw)
In-Reply-To: <20260507120434.2962505-1-i.maximets@ovn.org> (Ilya Maximets's message of "Thu, 7 May 2026 14:04:26 +0200")

Ilya Maximets <i.maximets@ovn.org> writes:

> NSH header length is a 6-bit field that encodes the total length of
> the header in 4-byte words.  So the maximum length is 0b111111 * 4,
> which is 252 and not 256.  The maximum context length is the same
> number minus the length of the base header (8), so 244.
>
> These macros are used to validate push_nsh() action in openvswitch.
> Miscalculation here doesn't cause any real issues.  In the worst case
> the oversized context is truncated while building the header, so we'll
> construct and send a broken packet, which is not a big problem, as any
> receiver should validate the fields.  No invalid memory accesses will
> happen during the header push.  But we should fix the macros to reject
> the incorrect actions in the first place.
>
> Using previously defined values and calculating the length instead
> of defining numbers directly, so it's easier to understand where they
> come from and harder to make a mistake.
>
> Fixes: 1f0b7744c505 ("net: add NSH header structures and helpers")
> Signed-off-by: Ilya Maximets <i.maximets@ovn.org>
> ---

Thanks Ilya!

Reviewed-by: Aaron Conole <aconole@redhat.com>


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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-07 12:04 [PATCH net] net: nsh: fix incorrect header length macros Ilya Maximets
2026-05-08 12:50 ` Aaron Conole [this message]
2026-05-08 22:40 ` 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=f7ta4uarrok.fsf@redhat.com \
    --to=aconole@redhat.com \
    --cc=davem@davemloft.net \
    --cc=dev@openvswitch.org \
    --cc=echaudro@redhat.com \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=i.maximets@ovn.org \
    --cc=jbenc@redhat.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=yi.y.yang@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.