Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp1420608imm; Thu, 5 Jul 2018 23:05:52 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdYhUwIi4ByyXVfpz/awXUT9bWr3ehJyJsgiLDTekE3zUVwtY2Q+C76BtezqtNd6VooLpXK X-Received: by 2002:a63:4a07:: with SMTP id x7-v6mr8326861pga.34.1530857152921; Thu, 05 Jul 2018 23:05:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530857152; cv=none; d=google.com; s=arc-20160816; b=XaNsQNOvn3z4S6Q17ZNaTxToREHuTVe/lRNQkIO6aYF71BonVbdkf995TZbFfmR+IX 7KLnrcXXb7dMzJ94XG9dkEL9tTeKcStABpy12ow9yO/e8LdAqjfOcfwQpCkYEHMLcrtk qRTQc2XQ+lnuYt6OxAbGVJ6t8tTlsqUepHL/JEyYwnkVnoNtXOGDhP+wB+CcHO7kJVdM dD0OQo9ygDO9h+7iochXmpjLQ9+Fl9HlFehstwh4xhRe2DzgsvTwZ3mGcUthUS2dG47h 1eGm08H0VuzBVAB4eqKBZsnDWDivvUAwI/2uC4KlyfNAufMl+HeIXRx8+NeH959oItTe xTwg== 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=xDgPbuYXFNSuZECdt4MmrVG2PNRgHtlaWYfZAi0c1S8=; b=H84976v2f6+NTmgHtd5a1WDnHqWK6Wi6yYijvnpwsooPOom9c6Dsl2+XCj1O9z0ga0 VowzKhuWkFKEro60KNk0lAoUXqoOZ8Vc7OBKmvC3t8rYo5Zo2X37Nwb+gEs6A0r0+Hpf 7hIkAwp44SH92pmTI0fyoqwv4I5eDb7BWT4+ZYdSoS1HLwRLt294p4Y6OGobcQJ6hxpm Tyz6cUU07M4Te9UVkvnDdHU9O3RinDn/kRdoxrs24XgUwCYqcVwLk53sXKRmC/Jrz/uv ra/jMHTbaCAj4srmgxCXlVWUyyhjb/BE0cCJLcKVdfpPAKCSrBI0tJX1V/78teZc9IS/ lPRA== 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 e62-v6si7837406pfe.327.2018.07.05.23.05.38; Thu, 05 Jul 2018 23:05:52 -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 S933682AbeGFFtq (ORCPT + 99 others); Fri, 6 Jul 2018 01:49:46 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:60376 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933663AbeGFFtl (ORCPT ); Fri, 6 Jul 2018 01:49:41 -0400 Received: from localhost (D57D388D.static.ziggozakelijk.nl [213.125.56.141]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 1AF2BB14; Fri, 6 Jul 2018 05:49:40 +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.17 43/46] netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain() Date: Fri, 6 Jul 2018 07:47:04 +0200 Message-Id: <20180706054526.754434739@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180706054524.595521988@linuxfoundation.org> References: <20180706054524.595521988@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.17-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;