All of lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Paulos Yibelo" <habte.yibelo@gmail.com>
Cc: "Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>,
	virtualization@lists.linux.dev
Subject: Re: [PATCH net v4 2/2] ipv4: reject partial checksums covering the IP header
Date: Mon, 21 Sep 2026 00:47:55 +0000	[thread overview]
Message-ID: <20260921004755.A71CB1F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260920004733.6473-3-habte.yibelo@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] ipv4: signed-to-unsigned conversion bypasses checksum offset validation
--

commit 35b578df884cddd68694d6e6f060c95a3382e235
Author: Paulos Yibelo <habte.yibelo@gmail.com>

ipv4: reject partial checksums covering the IP header

ip_do_fragment() completes a CHECKSUM_PARTIAL skb before reading the IPv4
header length. A virtualization interface can supply a checksum start that
still points inside the IPv4 header after link-layer removal.

> diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c
> index a24cc8ee11d3e..ff902a2dd0ade 100644
> --- a/net/ipv4/ip_output.c
> +++ b/net/ipv4/ip_output.c
> @@ -770,16 +770,28 @@ int ip_do_fragment(struct net *net, struct sock *sk, struct sk_buff *skb,

[ ... ]

> +	/* Complete offloaded checksums only after the validated IP header. */
> +	if (skb->ip_summed == CHECKSUM_PARTIAL) {
> +		if (unlikely(skb_checksum_start_offset(skb) < hlen)) {

[Severity: Medium]
Will this comparison correctly catch negative checksum offsets?

If a TUN/TAP device supplies a packet with a csum_start that points before
the linear data, skb_checksum_start_offset(skb) will return a negative int.

Since hlen is an unsigned int, this negative offset will be promoted to a
large unsigned value during the comparison, bypassing the validation check.

This could allow an invalid packet to proceed to skb_checksum_help(), which
safely aborts the operation but triggers a WARN_ONCE that can cause a panic
if panic_on_warn is enabled.

> +			err = -EINVAL;
> +			goto fail;
> +		}
> +		err = skb_checksum_help(skb);
> +		if (err)
> +			goto fail;
> +		iph = ip_hdr(skb);
> +	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260920004733.6473-1-habte.yibelo@gmail.com?part=2

  parent reply	other threads:[~2026-09-21  0:47 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-20  0:47 [PATCH net v4 0/2] net: prevent partial checksums from modifying IPv4 headers Paulos Yibelo
2026-09-20  0:47 ` [PATCH net v4 1/2] net: validate virtio checksum start after network header Paulos Yibelo
2026-09-20  1:11   ` David Ahern
2026-09-21  0:47   ` sashiko-bot
2026-09-20  0:47 ` [PATCH net v4 2/2] ipv4: reject partial checksums covering the IP header Paulos Yibelo
2026-09-20  1:12   ` David Ahern
2026-09-21  0:47   ` sashiko-bot [this message]
2026-09-21  2:53 ` [PATCH net v5 0/2] net: prevent partial checksums from modifying network headers Paulos Yibelo
2026-09-21  2:53   ` [PATCH net v5 1/2] net: validate virtio checksum start after network header Paulos Yibelo
2026-09-21  3:01     ` sashiko-bot
2026-09-21 22:11     ` Michael S. Tsirkin
2026-09-21 22:18     ` Michael S. Tsirkin
2026-09-21 22:44     ` Michael S. Tsirkin
2026-09-22  0:55       ` Paulos Yibelo
2026-09-24  8:54     ` netdev-bot+sashiko
2026-09-21  2:53   ` [PATCH net v5 2/2] ip: reject partial checksums covering network headers Paulos Yibelo
2026-09-21  3:01     ` sashiko-bot
2026-09-24  8:54     ` netdev-bot+sashiko

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=20260921004755.A71CB1F00893@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=habte.yibelo@gmail.com \
    --cc=mst@redhat.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@lists.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 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.