Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1415040imm; Thu, 5 Jul 2018 22:59:14 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcLH2IwRx+6ScLx2yYFpRYpbT5FfgHZdPJcbJsUeR3G6a5wfiit5evBims/vRxIblm0EvU0 X-Received: by 2002:a62:e30c:: with SMTP id g12-v6mr9342700pfh.25.1530856754505; Thu, 05 Jul 2018 22:59:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530856754; cv=none; d=google.com; s=arc-20160816; b=W9d7LBmvVJNnZqB60xHHcfGnz7XEddntNcYY7BjU5hlgEYf1j4Fn5QFyyWX2TKPTu3 6gUglvXs2xYDmQk5z5CKAP9A17MHWp+8O60L+2v3wwlaLkZfV5bTVcYZn7ZrBYwQWvn8 iHXqW38CsWk2s+0gDZ7kcBFARwmxlhjguVHHhi74zS0na8NcEMBSepggpDC+5G6thhiV t99PP8OTawGy5E6zePu8QXEoRWNxd+fjpz6+KTJP4lU2Nnv9c5lNKaKz1xG/CW3/hqgt pGkXLb57NruvH+cXV++lVGdpamjg6UJTAC2qv5OQ13et4gXXYMQRxnhkXzswp9AuCnUD w/Lg== 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=vGYzNpWNa8xM43Dv5K3mqgWgg/HH+Jl1U2HJBlPLRAQ=; b=FF6P/PRwDl/cOPP+Mo/n6oyTFjjB7YqxEZLF+dxLhBwUxUDzK0nQ9l7VMFewAHmyX2 ApJaJqTh63Tx5wbjN4gmfRtmApOnfXXCQCeu47s7dtv41qJ+07C8+LRyrvzdFN6fyBkf m5hgkd21CJA8nm5IZf95IjWoB735WAour+oSg4H41/37LlyAp1YiTuDEnPGNYbMC2gXX FOaJEibQOXR7TTz88Awg9cVmT6hC4kSoGlXXEbci5kIOrAoB4edegdkO9Gb07gi3fxYw aZTKsLjloHa4wcpkrVl6YqBPaEpwFffosGnxG3SQEiWwJkfOj+U7l3ve3/jDydUJHyEU qwXA== 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 h1-v6si7530906pld.485.2018.07.05.22.59.00; Thu, 05 Jul 2018 22:59:14 -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 S934513AbeGFF4i (ORCPT + 99 others); Fri, 6 Jul 2018 01:56:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:33462 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933234AbeGFFvn (ORCPT ); Fri, 6 Jul 2018 01:51:43 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 646A8BD8; Fri, 6 Jul 2018 05:51:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Taehee Yoo , Pablo Neira Ayuso Subject: [PATCH 4.14 42/61] netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain() Date: Fri, 6 Jul 2018 07:47:06 +0200 Message-Id: <20180706054713.952076082@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 adc972c5b88829d38ede08b1069718661c7330ae upstream. When depth of chain is bigger than NFT_JUMP_STACK_SIZE, the nft_do_chain crashes. But there is no need to crash hard here. Suggested-by: Florian Westphal Signed-off-by: Taehee Yoo Acked-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_tables_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/net/netfilter/nf_tables_core.c +++ b/net/netfilter/nf_tables_core.c @@ -208,7 +208,8 @@ next_rule: switch (regs.verdict.code) { case NFT_JUMP: - BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE); + if (WARN_ON_ONCE(stackptr >= NFT_JUMP_STACK_SIZE)) + return NF_DROP; jumpstack[stackptr].chain = chain; jumpstack[stackptr].rule = rule; jumpstack[stackptr].rulenum = rulenum;