public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Tom Rini <trini@konsulko.com>
To: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Cc: u-boot@lists.denx.de, Fabio Estevam <festevam@denx.de>,
	Nicolas Bidron <nicolas.bidron@nccgroup.com>,
	Joe Hershberger <joe.hershberger@ni.com>,
	Ramon Fried <rfried.dev@gmail.com>
Subject: Re: [PATCH 4/6] net: fix ip_len in reassembled IP datagram
Date: Mon, 28 Nov 2022 14:51:29 -0500	[thread overview]
Message-ID: <20221128195129.GE3787616@bill-the-cat> (raw)
In-Reply-To: <20221014174342.3216982-5-rasmus.villemoes@prevas.dk>

[-- Attachment #1: Type: text/plain, Size: 1310 bytes --]

On Fri, Oct 14, 2022 at 07:43:40PM +0200, Rasmus Villemoes wrote:

> For some reason, the ip_len field in a reassembled IP datagram is set
> to just the size of the payload, but it should be set to the value it
> would have had if the datagram had never been fragmented in the first
> place, i.e. size of payload plus size of IP header.
> 
> That latter value is currently returned correctly via the "len"
> variable. And before entering net_defragment(), len does have the
> value ntohs(ip->ip_len), so if we're not dealing with a
> fragment (so net_defragment leaves *len alone), that relationship of
> course also holds after the net_defragment() call.
> 
> The only use I can find of ip->ip_len after the net_defragment call is
> the ntohs(ip->udp_len) > ntohs(ip->ip_len) sanity check - none of the
> functions that are passed the "ip" pointer themselves inspect ->ip_len
> but instead use the passed len.
> 
> But that sanity check is a bit odd, since the RHS really should be
> "ntohs(ip->ip_len) - 20", i.e. the IP payload size.
> 
> Now that we've fixed things so that len == ntohs(ip->ip_len) in all
> cases, change that sanity check to use len-20 as the RHS.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>

Applied to u-boot/master, thanks!

-- 
Tom

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

  reply	other threads:[~2022-11-28 19:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 17:43 [PATCH 0/6] broken CVE fix (b85d130ea0ca) Rasmus Villemoes
2022-10-14 17:43 ` [PATCH 1/6] net: improve check for no IP options Rasmus Villemoes
2022-10-16 18:23   ` Ramon Fried
2022-11-28 19:51   ` Tom Rini
2022-10-14 17:43 ` [PATCH 2/6] net: compare received length to sizeof(ip_hdr), not sizeof(ip_udp_hdr) Rasmus Villemoes
2022-11-28 19:51   ` Tom Rini
2022-10-14 17:43 ` [PATCH 3/6] net: (actually/better) deal with CVE-2022-{30790,30552} Rasmus Villemoes
2022-11-28 19:51   ` Tom Rini
2022-10-14 17:43 ` [PATCH 4/6] net: fix ip_len in reassembled IP datagram Rasmus Villemoes
2022-11-28 19:51   ` Tom Rini [this message]
2022-10-14 17:43 ` [PATCH 5/6] net: tftp: use IS_ENABLED(CONFIG_NET_TFTP_VARS) instead of #if Rasmus Villemoes
2022-10-16 18:28   ` Ramon Fried
2022-10-17  6:18     ` Rasmus Villemoes
2022-11-28 19:51   ` Tom Rini
2022-10-14 17:43 ` [PATCH 6/6] net: tftp: sanitize tftp block size, especially for TX Rasmus Villemoes
2022-10-16 18:30   ` Ramon Fried
2022-11-28 19:51   ` Tom Rini
2022-10-15 12:57 ` [PATCH 0/6] broken CVE fix (b85d130ea0ca) Fabio Estevam
2022-10-17  7:52 ` [PATCH 7/6] net: deal with fragment-overlapping-two-holes case Rasmus Villemoes
2022-11-28 19:52   ` Tom Rini
2022-11-14  9:35 ` [PATCH 0/6] broken CVE fix (b85d130ea0ca) Rasmus Villemoes
2022-11-14 13:04   ` Tom Rini
2022-11-17  0:32     ` Fabio Estevam
2022-11-28  8:10       ` Rasmus Villemoes

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=20221128195129.GE3787616@bill-the-cat \
    --to=trini@konsulko.com \
    --cc=festevam@denx.de \
    --cc=joe.hershberger@ni.com \
    --cc=nicolas.bidron@nccgroup.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=rfried.dev@gmail.com \
    --cc=u-boot@lists.denx.de \
    /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