Netdev List
 help / color / mirror / Atom feed
* [PATCH net v3 0/5] net/sched: u32_change() fixes
@ 2026-11-30 12:30 Jedrzej Jagielski
  2026-11-30 12:30 ` [PATCH net v3 1/5] net/sched: cls_u32: fix linked hash table refcount leak Jedrzej Jagielski
                   ` (4 more replies)
  0 siblings, 5 replies; 14+ messages in thread
From: Jedrzej Jagielski @ 2026-11-30 12:30 UTC (permalink / raw)
  To: netdev; +Cc: anthony.l.nguyen, kuba, jhs, jiri, edumazet, Jedrzej Jagielski

Hi,

This series fixes four bugs in cls_u32's u32_change() function:

Since commit 695176bfe5de ("net_sched: refactor TC action init API")
u32_change() passes TCA_ACT_FLAGS_* instead of the u32 classifier flags
to u32_replace_hw_knode(), so skip_sw is ignored when offloading u32
knodes: tc_setup_cb_add() runs with err_stop == false, driver errors
are swallowed and a skip_sw filter that cannot be offloaded is reported
as successfully installed, while it matches neither in SW nor in HW.

Patch 4 fixes that. Doing so makes the error paths of
u32_replace_hw_knode() in u32_change() reachable again. They have been
dead code since 695176bfe5de and contain bugs, which patches 1-3 fix
first:

Patch 1 drops the n->ht_down reference at errunbind, which leaked the
linked hash table when offloading a new knode with TCA_U32_LINK failed.

Patch 2 removes a refcount_inc() in the replace error path, which
"undid" a decrement already balanced by u32_init_knode() and leaked a
reference on the old linked hash table.

Patch 3 stops the rollback from sending TC_CLSU32_DELETE_KNODE on a
failed replace. The new knode shares its handle with the still
installed old one, so the rollback removed the old HW rule. It also
documents the trade-off for blocks with multiple offload callbacks
and hints userspace via extack that HW may be partially updated.

Patch 5 adds a tdc test checking that a skip_sw u32 filter is rejected
on a device without offload support.

Note that with patch 4, skip_sw add/replace commands which cannot be
offloaded now fail with -EOPNOTSUPP/-EINVAL instead of silently
succeeding.

v2:
- add fixes for 2 preexisting issues uncovered by the initial fix
v3:
- reorder: fixes first, skip_sw fix after them, so no bisect point
- add 'don't remove old HW rule on failed knode replace' fix
- add selftest
- alter cover letter content

Jedrzej Jagielski (5):
  net/sched: cls_u32: fix linked hash table refcount leak
  net/sched: cls_u32: remove erroneous refcount_inc()
  net/sched: cls_u32: don't remove old HW rule on failed knode replace
  net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of
    flags
  selftests: tc-testing: add u32 skip_sw test

 net/sched/cls_u32.c                           | 26 +++++++++----------
 .../tc-testing/tc-tests/filters/u32.json      | 22 ++++++++++++++++
 2 files changed, 35 insertions(+), 13 deletions(-)

-- 
2.31.1


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2026-12-01 12:54 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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
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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox