• Cong Wang's avatar
    net_sched: fix a memory leak in cls_tcindex · b386a4b2
    Cong Wang authored
    [ Upstream commit 033b228e ]
    
    When tcindex_destroy() destroys all the filter results in
    the perfect hash table, it invokes the walker to delete
    each of them. However, results with class==0 are skipped
    in either tcindex_walk() or tcindex_delete(), which causes
    a memory leak reported by kmemleak.
    
    This patch fixes it by skipping the walker and directly
    deleting these filter results so we don't miss any filter
    result.
    
    As a result of this change, we have to initialize exts->net
    properly in tcindex_alloc_perfect_hash(). For net-next, we
    need to consider whether we should initialize ->net in
    tcf_exts_init() instead, before that just directly test
    CONFIG_NET_CLS_ACT=y.
    
    Cc: Jamal Hadi Salim <jhs@mojatatu.com>
    Cc: Jiri Pirko <jiri@resnulli.us>
    Signed-off-by: 's avatarCong Wang <xiyou.wangcong@gmail.com>
    Signed-off-by: 's avatarDavid S. Miller <davem@davemloft.net>
    Signed-off-by: 's avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    b386a4b2
Name
Last commit
Last update
Documentation Loading commit data...
LICENSES Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.clang-format Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...