Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1419454imm; Thu, 5 Jul 2018 23:04:23 -0700 (PDT) X-Google-Smtp-Source: AAOMgpddjlsTs5wSPhqjljCxNcZ9EVyKAdsZyFuWAWeAJZI+kH5weFxU65JuWZ8G/8aqxYPMJ4qU X-Received: by 2002:a63:2f04:: with SMTP id v4-v6mr8110731pgv.33.1530857063923; Thu, 05 Jul 2018 23:04:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857063; cv=none; d=google.com; s=arc-20160816; b=bs2pZ/fdJ+DP/TC+un1QJMuBXQuVaHrMwy+Nx2u9r6suwzXPxzfdyoXUT5grGr2KuC mFbxR40FFDA+SF4TX3ExTAqTZGurhLWA5oEz+jjEi+6O8pIIZDMb+3sx6UUVxzgWF4jV nY407MFeLEZoBw2jri57CASKHN996nK/i2UoGdamI7Z/P4zYPPJIBILdaW9WlCYdf6F+ 8KZRN42JbU/dwYkHThUId+1PhncbV/JS3T1NZpEnCn8kPmtQPUXc3anNT2e/qgUBZXGH snzcFmVb8b/I7z+Rj7fpFJtBHLL626IvEUJMpuEl7nGaIEG88+ml+iMKbB3fknyDpqTQ s0Tw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=le2GyO5yssM1UasOL7WhJS2SQ7Icpu2DCCAv/RunJA4=; b=vR3FPJ5p70yxZsRNniyU2cKLy+gsv0twP/7Mt3D+TtDL/u345gSXyX2e4afPj9122E zEVFKyPXo9lWVr6SY9bChs0JkhdUHRdUS7mgNKt5Sdi4p7Y9t+kQQfE8U9XymFjyfQy4 lM6GEDtddsmWPvCxsRX09tj+ZWuCWhfJqSQwPvBtYEX6Hf80GpFsUy/X1CGlSaYs5+kC 1JQPo3HEcGE5l7HlH2gFuXkWnRspwy4iobfkaQ5KQG5X/w7Dvazic+N2CA7o3+5ICed1 nFSYfauy3JicLMmEptS5msSjYD3K6zAY4McPGBv3QrUc+FgqTbPmGgZAX+QXdm7iHXrh kIrw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t1-v6si8740069pfm.7.2018.07.05.23.03.46; Thu, 05 Jul 2018 23:04:23 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934128AbeGFFvF (ORCPT + 99 others); Fri, 6 Jul 2018 01:51:05 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33156 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933976AbeGFFvD (ORCPT ); Fri, 6 Jul 2018 01:51:03 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 7F1FE86A; Fri, 6 Jul 2018 05:51:02 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , Pablo Neira Ayuso Subject: [PATCH 4.14 30/61] netfilter: nf_tables: increase nft_counters_enabled in nft_chain_stats_replace() Date: Fri, 6 Jul 2018 07:46:54 +0200 Message-Id: <20180706054713.488680103@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054712.332416244@linuxfoundation.org> References: <20180706054712.332416244@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: Taehee Yoo commit bbb8c61f97e3a2dd91b30d3e57b7964a67569d11 upstream. When a chain is updated, a counter can be attached. if so, the nft_counters_enabled should be increased. test commands: %nft add table ip filter %nft add chain ip filter input { type filter hook input priority 4\; } %iptables-compat -Z input %nft delete chain ip filter input we can see below messages. [ 286.443720] jump label: negative count! [ 286.448278] WARNING: CPU: 0 PID: 1459 at kernel/jump_label.c:197 __static_key_slow_dec_cpuslocked+0x6f/0xf0 [ 286.449144] Modules linked in: nf_tables nfnetlink ip_tables x_tables [ 286.449144] CPU: 0 PID: 1459 Comm: nft Tainted: G W 4.17.0-rc2+ #12 [ 286.449144] RIP: 0010:__static_key_slow_dec_cpuslocked+0x6f/0xf0 [ 286.449144] RSP: 0018:ffff88010e5176f0 EFLAGS: 00010286 [ 286.449144] RAX: 000000000000001b RBX: ffffffffc0179500 RCX: ffffffffb8a82522 [ 286.449144] RDX: 0000000000000001 RSI: 0000000000000008 RDI: ffff88011b7e5eac [ 286.449144] RBP: 0000000000000000 R08: ffffed00236fce5c R09: ffffed00236fce5b [ 286.449144] R10: ffffffffc0179503 R11: ffffed00236fce5c R12: 0000000000000000 [ 286.449144] R13: ffff88011a28e448 R14: ffff88011a28e470 R15: dffffc0000000000 [ 286.449144] FS: 00007f0384328700(0000) GS:ffff88011b600000(0000) knlGS:0000000000000000 [ 286.449144] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 286.449144] CR2: 00007f038394bf10 CR3: 0000000104a86000 CR4: 00000000001006f0 [ 286.449144] Call Trace: [ 286.449144] static_key_slow_dec+0x6a/0x70 [ 286.449144] nf_tables_chain_destroy+0x19d/0x210 [nf_tables] [ 286.449144] nf_tables_commit+0x1891/0x1c50 [nf_tables] [ 286.449144] nfnetlink_rcv+0x1148/0x13d0 [nfnetlink] [ ... ] Signed-off-by: Taehee Yoo Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_api.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -1266,8 +1266,10 @@ static void nft_chain_stats_replace(stru rcu_assign_pointer(chain->stats, newstats); synchronize_rcu(); free_percpu(oldstats); - } else + } else { rcu_assign_pointer(chain->stats, newstats); + static_branch_inc(&nft_counters_enabled); + } } static void nf_tables_chain_destroy(struct nft_chain *chain)