Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: jedrzej.jagielski@intel.com
Cc: netdev@vger.kernel.org, anthony.l.nguyen@intel.com,
	kuba@kernel.org, jhs@mojatatu.com, jiri@resnulli.us,
	edumazet@google.com, stable@vger.kernel.org,
	sashiko-bot@kernel.org
Subject: Re: [PATCH net v3 1/5] net/sched: cls_u32: fix linked hash table refcount leak
Date: Tue, 01 Dec 2026 12:54:46 +0000	[thread overview]
Message-ID: <179612968645.3146.10471010351182445151@kernel.org> (raw)
In-Reply-To: <20261130123028.516696-2-jedrzej.jagielski@intel.com>

Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The commit message calls the fixed path "currently dead code"
  that only becomes live once "net/sched: cls_u32: feed…

--

net/sched: cls_u32: fix linked hash table refcount leak

This patch drops the reference on n->ht_down at the errunbind label in
u32_change(). With it, a failed u32_replace_hw_knode() call no longer
leaks the refcount on the linked tc_u_hnode. The commit message calls this
a forward fix for an error path that can't be reached yet.

> This is a forward fix for currently dead code, which will be uncovered
> by the upcoming patch "net/sched: cls_u32: feed u32_replace_hw_knode()
> with correct set of flags".
>
> Fixes: d34e3e181395 ("net: cls_u32: Add support for skip-sw flag to tc u32 classifier.")
> Cc: stable@vger.kernel.org

[Severity: Low]
Is "currently dead code" accurate for every tree the Cc: stable tag will
reach?

In mainline the path does look unreachable. u32_change() passes the
kernel request flags (TCA_ACT_FLAGS_*) instead of userflags:

	err = u32_replace_hw_knode(tp, n, flags, extack);

So tc_skip_sw(flags) in u32_replace_hw_knode() is always false. That
means tc_setup_cb_add() runs with err_stop=false and returns 0.

Before 695176bfe5de ("net_sched: refactor TC action init API") in v5.15,
u32_change() passed the user flags directly:

	flags = nla_get_u32(tb[TCA_U32_FLAGS]);
	...
	err = u32_replace_hw_knode(tp, n, flags, extack);

In a tree like 5.10, take a skip_sw filter with TCA_U32_LINK on a block
that cannot offload. tc_setup_cb_add() then returns -EOPNOTSUPP. The errhw
path frees n with kfree(n) but never drops the refcount on n->ht_down.

After that, refcount_dec_if_one() fails in u32_delete(), so deleting the
linked hash table returns -EBUSY. In those trees, anyone with
CAP_NET_ADMIN in a network namespace can trigger the leak today.

This patch also won't apply there as written. v5.10 has no errunbind
label and no u32_unbind_filter() call, so it would need a manual
backport.

The enabling patch named here would carry Fixes: 695176bfe5de, so it
won't reach pre-5.15 trees either. For v5.15 and later, the dependency on
that companion patch is already stated clearly.

Could the commit message mention that the leak is live in stable trees
older than v5.15? Otherwise, someone handling a failed-to-apply stable
report could drop this fix for 5.10, the one tree where it fixes a bug
that can actually be reached.

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261130123028.516696-1-jedrzej.jagielski%40intel.com

  parent reply	other threads:[~2026-12-01 12:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30 12:30 [PATCH net v3 0/5] net/sched: u32_change() fixes Jedrzej Jagielski
2026-11-30 12:30 ` [PATCH net v3 1/5] net/sched: cls_u32: fix linked hash table refcount leak Jedrzej Jagielski
2026-11-30 19:07   ` Jamal Hadi Salim
2026-12-01 12:54   ` netdev-bot+sashiko [this message]
2026-11-30 12:30 ` [PATCH net v3 2/5] net/sched: cls_u32: remove erroneous refcount_inc() Jedrzej Jagielski
2026-11-30 19:07   ` Jamal Hadi Salim
2026-11-30 12:30 ` [PATCH net v3 3/5] net/sched: cls_u32: don't remove old HW rule on failed knode replace Jedrzej Jagielski
2026-11-30 19:18   ` Jamal Hadi Salim
2026-11-30 19:19     ` Jamal Hadi Salim
2026-11-30 12:30 ` [PATCH net v3 4/5] net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of flags Jedrzej Jagielski
2026-11-30 19:25   ` Jamal Hadi Salim
2026-12-01 12:54   ` netdev-bot+sashiko
2026-11-30 12:30 ` [PATCH net v3 5/5] selftests: tc-testing: add u32 skip_sw test Jedrzej Jagielski
2026-11-30 19:26   ` Jamal Hadi Salim

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=179612968645.3146.10471010351182445151@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=anthony.l.nguyen@intel.com \
    --cc=edumazet@google.com \
    --cc=jedrzej.jagielski@intel.com \
    --cc=jhs@mojatatu.com \
    --cc=jiri@resnulli.us \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=sashiko-bot@kernel.org \
    --cc=stable@vger.kernel.org \
    /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