]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
net: sched: cls_u32: Undo refcount decrement in case update failed
authorVictor Nogueira <victor@mojatatu.com>
Thu, 13 Jul 2023 18:05:12 +0000 (15:05 -0300)
committerRoxana Nicolescu <roxana.nicolescu@canonical.com>
Mon, 2 Oct 2023 15:20:38 +0000 (17:20 +0200)
commitc350d5aa0d3c758726297908bae92e164d57a718
tree7ce732fa2eecb6524e516bd2eaf1c5df9a4388d1
parentcf1a598adee731bdc6ce9689b242ebbba0a232cf
net: sched: cls_u32: Undo refcount decrement in case update failed

BugLink: https://bugs.launchpad.net/bugs/2037005
[ Upstream commit e8d3d78c19be0264a5692bed477c303523aead31 ]

In the case of an update, when TCA_U32_LINK is set, u32_set_parms will
decrement the refcount of the ht_down (struct tc_u_hnode) pointer
present in the older u32 filter which we are replacing. However, if
u32_replace_hw_knode errors out, the update command fails and that
ht_down pointer continues decremented. To fix that, when
u32_replace_hw_knode fails, check if ht_down's refcount was decremented
and undo the decrement.

Fixes: d34e3e181395 ("net: cls_u32: Add support for skip-sw flag to tc u32 classifier.")
Signed-off-by: Victor Nogueira <victor@mojatatu.com>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Reviewed-by: Pedro Tammela <pctammela@mojatatu.com>
Reviewed-by: Simon Horman <simon.horman@corigine.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Roxana Nicolescu <roxana.nicolescu@canonical.com>
net/sched/cls_u32.c