From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [patch net-next] net: sched: fix use-after-free in tcf_block_put_ext Date: Fri, 08 Dec 2017 14:10:31 -0500 (EST) Message-ID: <20171208.141031.2301375886294498593.davem@davemloft.net> References: <20171208182727.4100-1-jiri@resnulli.us> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org, jhs@mojatatu.com, xiyou.wangcong@gmail.com, mlxsw@mellanox.com, code@rkapl.cz To: jiri@resnulli.us Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:57528 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752431AbdLHTKd (ORCPT ); Fri, 8 Dec 2017 14:10:33 -0500 In-Reply-To: <20171208182727.4100-1-jiri@resnulli.us> Sender: netdev-owner@vger.kernel.org List-ID: From: Jiri Pirko Date: Fri, 8 Dec 2017 19:27:27 +0100 > From: Jiri Pirko > > Since the block is freed with last chain being put, once we reach the > end of iteration of list_for_each_entry_safe, the block may be > already freed. I'm hitting this only by creating and deleting clsact: ... > Fix this by holding the block also by chain 0 and put chain 0 > explicitly, out of the list_for_each_entry_safe loop at the very > end of tcf_block_put_ext. > > Fixes: efbf78973978 ("net_sched: get rid of rcu_barrier() in tcf_block_put_ext()") > Signed-off-by: Jiri Pirko Applied, thanks Jiri.