From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH v2] net: sched: fix crash when deleting secondary chains Date: Fri, 24 Nov 2017 01:27:16 +0900 (KST) Message-ID: <20171124.012716.1134458426501486126.davem@davemloft.net> References: <20171119173632.13125-1-code@rkapl.cz> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: netdev@vger.kernel.org To: code@rkapl.cz Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:44172 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751807AbdKWQ1R (ORCPT ); Thu, 23 Nov 2017 11:27:17 -0500 In-Reply-To: <20171119173632.13125-1-code@rkapl.cz> Sender: netdev-owner@vger.kernel.org List-ID: From: Roman Kapl Date: Mon, 20 Nov 2017 22:21:13 +0100 > If you flush (delete) a filter chain other than chain 0 (such as when > deleting the device), the kernel may run into a use-after-free. The > chain refcount must not be decremented unless we are sure we are done > with the chain. > > To reproduce the bug, run: > ip link add dtest type dummy > tc qdisc add dev dtest ingress > tc filter add dev dtest chain 1 parent ffff: flower > ip link del dtest > > Introduced in: commit f93e1cdcf42c ("net/sched: fix filter flushing"), > but unless you have KAsan or luck, you won't notice it until > commit 0dadc117ac8b ("cls_flower: use tcf_exts_get_net() before call_rcu()") > > Fixes: f93e1cdcf42c ("net/sched: fix filter flushing") > Acked-by: Jiri Pirko > Signed-off-by: Roman Kapl Applied, thank you.