From: David Miller <davem@davemloft.net>
To: xiyou.wangcong@gmail.com
Cc: netdev@vger.kernel.org, jhs@mojatatu.com, jiri@resnulli.us
Subject: Re: [Patch net-next 2/2] net_sched: fix a memory leak in cls_tcindex
Date: Wed, 20 Feb 2019 20:11:57 -0800 (PST) [thread overview]
Message-ID: <20190220.201157.306268622139550136.davem@davemloft.net> (raw)
In-Reply-To: <20190216185827.21535-2-xiyou.wangcong@gmail.com>
From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Sat, 16 Feb 2019 10:58:27 -0800
> (cherry picked from commit 033b228e7f26b29ae37f8bfa1bc6b209a5365e9f)
>
> 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: Cong Wang <xiyou.wangcong@gmail.com>
Applied.
next prev parent reply other threads:[~2019-02-21 4:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-16 18:58 [Patch net-next 1/2] net_sched: fix a race condition in tcindex_destroy() Cong Wang
2019-02-16 18:58 ` [Patch net-next 2/2] net_sched: fix a memory leak in cls_tcindex Cong Wang
2019-02-21 4:11 ` David Miller [this message]
2019-02-21 4:11 ` [Patch net-next 1/2] net_sched: fix a race condition in tcindex_destroy() David Miller
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=20190220.201157.306268622139550136.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=jhs@mojatatu.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).