]> git.baikalelectronics.ru Git - kernel.git/commit
net/sched: cls_u32: fix possible leak in u32_init_knode()
authorEric Dumazet <edumazet@google.com>
Wed, 13 Apr 2022 17:35:42 +0000 (10:35 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 15 Apr 2022 21:26:11 +0000 (14:26 -0700)
commit6e562961d98996fec8b0335ff37b942e116380af
treec6bc22db7a85cf9dd8db4918bb9143a9f8eeb93c
parent52e66d3aaa6d9834d885c60f4f57b072e9bc87ca
net/sched: cls_u32: fix possible leak in u32_init_knode()

While investigating a related syzbot report,
I found that whenever call to tcf_exts_init()
from u32_init_knode() is failing, we end up
with an elevated refcount on ht->refcnt

To avoid that, only increase the refcount after
all possible errors have been evaluated.

Fixes: 224fdce15787 ("net_sched: properly handle failure case of tcf_exts_init()")
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Acked-by: Jamal Hadi Salim <jhs@mojatatu.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/sched/cls_u32.c