From: Przemek Kitszel <przemyslaw.kitszel@intel.com>
To: Jedrzej Jagielski <jedrzej.jagielski@intel.com>,
<netdev@vger.kernel.org>
Cc: <anthony.l.nguyen@intel.com>, <kuba@kernel.org>,
<jhs@mojatatu.com>, <jiri@resnulli.us>, <edumazet@google.com>
Subject: Re: [PATCH net v2 0/3] net/sched: u32_change() fixes
Date: Mon, 17 Aug 2026 14:42:30 +0200 [thread overview]
Message-ID: <ccba8112-ff9a-47ea-8b91-a732e28b555d@intel.com> (raw)
In-Reply-To: <20260813122242.1690024-1-jedrzej.jagielski@intel.com>
On 8/13/26 14:22, Jedrzej Jagielski wrote:
> sorry for spam, previous series get treated as incomplete so resending
>
> ALREADY ON NETDEV, SASHIKO RUN
hehe
ofc, the above does no harm here
for the series:
Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@intel.com>
--
Sashiko has found one more *preexisting* bug, perhaps it could be
handled by one more fix in future series?:
https://sashiko.dev/#/patchset/20260813122242.1690024-1-jedrzej.jagielski%40intel.com
> @@ -938,14 +938,6 @@ static int u32_change(struct net *net, struct
sk_buff *in_skb,
> err = u32_replace_hw_knode(tp, new, userflags, extack);
> if (err) {
> u32_unbind_filter(tp, new, tb);
> -
> - if (tb[TCA_U32_LINK]) {
> - struct tc_u_hnode *ht_old;
> -
> - ht_old = rtnl_dereference(n->ht_down);
> - if (ht_old)
> - refcount_inc(&ht_old->refcnt);
> - }
> __u32_destroy_key(new);
> return err;
> }
This isn't a bug introduced by this patch, but looking at u32_change(),
there
appears to be a pre-existing issue with how manual hash table handles are
tracked in the IDR.
When a user creates a u32 hash table with a manual handle (for example,
0x80100000), u32_change() inserts the full handle directly into
tp_c->handle_idr:
net/sched/cls_u32.c:u32_change() {
...
} else {
err = idr_alloc_u32(&tp_c->handle_idr, ht, &handle,
handle, GFP_KERNEL);
...
}
However, when destroying the node later, u32_destroy_hnode() removes the
mapped ID rather than the full handle:
net/sched/cls_u32.c:u32_destroy_hnode() {
...
idr_remove(&tp_c->handle_idr, handle2id(ht->handle));
...
}
For a handle like 0x80100000, handle2id() returns 1. Does this mean the IDR
entry at 0x80100000 is permanently leaked, while index 1 is erroneously
freed?
If index 1 is already in use by an active auto-generated hash table, could
freeing it here allow gen_new_htid() to issue the same handle again to a new
hash table, causing collisions?
next prev parent reply other threads:[~2026-08-17 12:42 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 12:22 [PATCH net v2 0/3] net/sched: u32_change() fixes Jedrzej Jagielski
2026-08-13 12:22 ` [PATCH net v2 1/3] net/sched: cls_u32: feed u32_replace_hw_knode() with correct set of flags Jedrzej Jagielski
2026-08-18 9:51 ` Paolo Abeni
2026-08-13 12:22 ` [PATCH net v2 2/3] net/sched: cls_u32: fix linked hash table refcount leak Jedrzej Jagielski
2026-08-18 9:51 ` Paolo Abeni
2026-08-13 12:22 ` [PATCH net v2 3/3] net/sched: cls_u32: remove erroneous refcount_inc() Jedrzej Jagielski
2026-08-17 12:42 ` Przemek Kitszel [this message]
2026-08-18 7:46 ` [PATCH net v2 0/3] net/sched: u32_change() fixes Jagielski, Jedrzej
2026-08-18 9:51 ` Jamal Hadi Salim
2026-08-19 9:43 ` Jagielski, Jedrzej
2026-08-18 9:55 ` Paolo Abeni
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=ccba8112-ff9a-47ea-8b91-a732e28b555d@intel.com \
--to=przemyslaw.kitszel@intel.com \
--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 \
/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.