All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: Su Sai <spiderdetective.ss@gmail.com>
Cc: marat.khalili@huawei.com, dev@dpdk.org
Subject: Re: [v4] net/cksum: compute raw cksum for several segments
Date: Fri, 3 Jul 2026 07:41:32 -0700	[thread overview]
Message-ID: <20260703074132.2a718abe@phoenix.local> (raw)
In-Reply-To: <20260618063242.99189-1-spiderdetective.ss@gmail.com>

On Thu, 18 Jun 2026 14:32:42 +0800
Su Sai <spiderdetective.ss@gmail.com> wrote:

> The rte_raw_cksum_mbuf function is used to compute
> the raw checksum of a packet.
> If the packet payload stored in multi mbuf, the function
> will goto the hard case. In hard case,
> the variable 'tmp' is a type of uint32_t,
> so rte_bswap16 will drop high 16 bit.
> Meanwhile, the variable 'sum' is a type of uint32_t,
> so 'sum += tmp' will drop the carry when overflow.
> Both drop will make cksum incorrect.
> This commit fixes the above bug.
> 
> Signed-off-by: Su Sai <spiderdetective.ss@gmail.com>
> Acked-by: Marat Khalili <marat.khalili@huawei.com>
> ---

Still one error in the test.

Error — double-free in test_l4_cksum_multi_mbufs() (app/test/test_cksum.c)
The segments are chained into one packet (rte_pktmbuf_chain sets
m[0]->next = m[1], m[1]->next = m[2]), but cleanup then calls
rte_pktmbuf_free_bulk(m, segs_len) over the array.
rte_pktmbuf_free_bulk walks the ->next chain of each array element, so
index 0 frees the entire chain (m[0], m[1], m[2]), and indices 1 and 2
then free m[1]/m[2] a second time. This fires on the normal success
path every run, and on the fail path whenever ≥2 segments were chained
— a debug/ASAN build will abort on the sanity check, and a normal build
corrupts pool accounting. The array-of-independent-mbufs contract that
free_bulk expects doesn't hold here because the elements alias one
chain. Free the chain once through its head:

  reply	other threads:[~2026-07-03 14:41 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-31  9:55 [PATCH] net/cksum: compute raw cksum for several segments 苏赛
2025-07-31 10:51 ` Marat Khalili
2025-07-31 11:03   ` Marat Khalili
2025-07-31 11:31     ` [External] " Su Sai
2025-07-31 11:43       ` Marat Khalili
2025-07-31 11:46 ` Marat Khalili
2025-07-31 12:22 ` zhoumin
2025-08-01  7:26 ` Su Sai
2025-08-01 15:28 ` [v2] " Su Sai
2025-08-01 16:39   ` Marat Khalili
2025-08-02 11:08   ` [v3] " Su Sai
2025-08-03 16:08     ` Stephen Hemminger
2025-08-04  3:54       ` Su Sai
2025-08-05  8:55         ` Marat Khalili
2026-02-20 15:49           ` Marat Khalili
2026-02-20 17:23             ` Thomas Monjalon
2026-02-20 18:17               ` Marat Khalili
2026-02-20 18:35                 ` Marat Khalili
2026-02-27  6:36                   ` su sai
2026-02-27  7:31                   ` su sai
2026-03-06 15:17                   ` Marat Khalili
2025-08-11 14:42         ` Thomas Monjalon
2025-08-12  3:03           ` su sai
2026-02-20 17:49         ` Stephen Hemminger
2026-06-08 17:02         ` Stephen Hemminger
2026-06-16 12:30           ` [v4] " Su Sai
2026-06-16 12:38           ` Su Sai
2026-06-17 20:02             ` Marat Khalili
2026-06-18  6:32               ` Su Sai
2026-07-03 14:41                 ` Stephen Hemminger [this message]
2026-07-08  7:17                   ` [v5] " Su Sai
2026-07-08  7:26                   ` [v4] " su sai
2026-06-18  6:37               ` su sai
2026-06-16 12:48           ` [v3] " su sai

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=20260703074132.2a718abe@phoenix.local \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=marat.khalili@huawei.com \
    --cc=spiderdetective.ss@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 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.