Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp2009192imm; Tue, 10 Jul 2018 11:31:17 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcjL7bD+kccff3cpUhNFX/W+5w20DHlh4z/hcPXL48SJjUZfL0wPoJKln6dRzTYKcCucDie X-Received: by 2002:a17:902:b81:: with SMTP id 1-v6mr26135520plr.164.1531247477649; Tue, 10 Jul 2018 11:31:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531247477; cv=none; d=google.com; s=arc-20160816; b=cZS86JANBGsZyfmM+H/iC6W5mKv+LAvOW3cL1q5+uMthcOm+8pcTIHXNkh5JA12ipg eI96ZzeaA5rBzoGln0OkXD+rf7SiCXBQuNBjLrAFdiiaimNZABB1CXOK2FNeNCK07q35 QHcxdG+vGKjHywGWTvFWULhkdbnBfGaapFl9WcTytdIWv8RsAaHtp3CxXlpcQ20HQp9F Yp9x/C2fkR0yJTDdJXbaaMsTApUnnxS+SOxnoZXmrohqCRD56+sFtsHGB6EEsGSqM+2Y TxrNiTeFFHvPN+i6T4XQdQEQk831IIU7AKs7XknWHn4+AwNgkE3HD+fIUU3WgXrLNdyY fDwQ== 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=mArA4+JgNK3rZtoL9ygQaVkbDTBNjNfzTlAhxwhjHIc=; b=Xb9e394WzITTgvKY9mE5XwQbco9mPevnhNPVdbdrSjZUpllErJ21vfC6HOtWctOcEx DRkijGD8+mrPzPMN3Hp4ReQRRkY4PXzMsGZTD4tTV0sUUixpWVb4WVITnQJ828HTfX9/ agZ2SXA2fBhPLLBfMk0ckpxKR9WdERe+zFGV5HmmrZEBn2dyAcwbdk0Ef0GZham2/7eq RXj99xAUh7xDP8PyGgKsW06cJZ9Mc5AsyvoHEApH3J0iS0CeLsmE9Wmh7LuQsoRAoysQ uT4FoXun8nHeyhmeog9mNh7sZVIRkzFcy7e3mwMwWMRpBIDx/3ZjOV0ucwiwI/n63vTY zyPQ== 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 q9-v6si8784562pgc.685.2018.07.10.11.31.01; Tue, 10 Jul 2018 11:31:17 -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 S2387782AbeGJS3c (ORCPT + 99 others); Tue, 10 Jul 2018 14:29:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:45350 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732245AbeGJS3b (ORCPT ); Tue, 10 Jul 2018 14:29:31 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2B402EB8; Tue, 10 Jul 2018 18:29:20 +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.9 12/52] netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain() Date: Tue, 10 Jul 2018 20:24:40 +0200 Message-Id: <20180710182450.745062875@linuxfoundation.org> X-Mailer: git-send-email 2.18.0 In-Reply-To: <20180710182449.285532226@linuxfoundation.org> References: <20180710182449.285532226@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.9-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 @@ -185,7 +185,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;