]> git.hungrycats.org Git - linux/commit
net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes.
authorAlexandre Ferrieux <alexandre.ferrieux@gmail.com>
Sun, 10 Nov 2024 17:28:36 +0000 (18:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 22 Nov 2024 14:37:30 +0000 (15:37 +0100)
commit9b2c3184e126b941dfa716b8128ed6db92a64e2f
tree8e58ca4675a61521868052effc6de6a06da13d10
parentd848eb0b32682e5f42b2bd38a8e33b6eb82bbb70
net: sched: cls_u32: Fix u32's systematic failure to free IDR entries for hnodes.

[ Upstream commit 73af53d82076bbe184d9ece9e14b0dc8599e6055 ]

To generate hnode handles (in gen_new_htid()), u32 uses IDR and
encodes the returned small integer into a structured 32-bit
word. Unfortunately, at disposal time, the needed decoding
is not done. As a result, idr_remove() fails, and the IDR
fills up. Since its size is 2048, the following script ends up
with "Filter already exists":

  tc filter add dev myve $FILTER1
  tc filter add dev myve $FILTER2
  for i in {1..2048}
  do
    echo $i
    tc filter del dev myve $FILTER2
    tc filter add dev myve $FILTER2
  done

This patch adds the missing decoding logic for handles that
deserve it.

Fixes: e7614370d6f0 ("net_sched: use idr to allocate u32 filter handles")
Reviewed-by: Eric Dumazet <edumazet@google.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Alexandre Ferrieux <alexandre.ferrieux@orange.com>
Tested-by: Victor Nogueira <victor@mojatatu.com>
Link: https://patch.msgid.link/20241110172836.331319-1-alexandre.ferrieux@orange.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sched/cls_u32.c