netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: xiyou.wangcong@gmail.com
Cc: netdev@vger.kernel.org, bugs@abtelecom.ro, ben@decadent.org.uk,
	jhs@mojatatu.com, jiri@resnulli.us
Subject: Re: [Patch net-next 1/2] net_sched: fix a race condition in tcindex_destroy()
Date: Wed, 20 Feb 2019 20:11:52 -0800 (PST)	[thread overview]
Message-ID: <20190220.201152.690801599680073310.davem@davemloft.net> (raw)
In-Reply-To: <20190216185827.21535-1-xiyou.wangcong@gmail.com>

From: Cong Wang <xiyou.wangcong@gmail.com>
Date: Sat, 16 Feb 2019 10:58:26 -0800

> (cherry picked from commit 8015d93ebd27484418d4952284fd02172fa4b0b2)
> 
> tcindex_destroy() invokes tcindex_destroy_element() via
> a walker to delete each filter result in its perfect hash
> table, and tcindex_destroy_element() calls tcindex_delete()
> which schedules tcf RCU works to do the final deletion work.
> Unfortunately this races with the RCU callback
> __tcindex_destroy(), which could lead to use-after-free as
> reported by Adrian.
> 
> Fix this by migrating this RCU callback to tcf RCU work too,
> as that workqueue is ordered, we will not have use-after-free.
> 
> Note, we don't need to hold netns refcnt because we don't call
> tcf_exts_destroy() here.
> 
> Fixes: 27ce4f05e2ab ("net_sched: use tcf_queue_work() in tcindex filter")
> Reported-by: Adrian <bugs@abtelecom.ro>
> Cc: Ben Hutchings <ben@decadent.org.uk>
> Cc: Jamal Hadi Salim <jhs@mojatatu.com>
> Cc: Jiri Pirko <jiri@resnulli.us>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Applied.

      parent reply	other threads:[~2019-02-21  4:11 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
2019-02-21  4:11 ` David Miller [this message]

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.201152.690801599680073310.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=ben@decadent.org.uk \
    --cc=bugs@abtelecom.ro \
    --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).