Received: by 10.192.165.148 with SMTP id m20csp534463imm; Wed, 25 Apr 2018 03:51:13 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/42dQ2ZWOd6D+mLyMcokLbPP4z/v+iuigShnSc4NyLj4p0+jXxdYSS+WQFT0mSGUO6JED2 X-Received: by 10.99.102.196 with SMTP id a187mr23581208pgc.349.1524653473490; Wed, 25 Apr 2018 03:51:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524653473; cv=none; d=google.com; s=arc-20160816; b=LHpZEdOkfNYAhBeBtght3CWo17CjvZpHPA6gaJ7gv30MeSEHfEsnX2+2WiSMPdO5wX Uvyrk9cRqWDPbC34ux9FSSymnstP0oBxaeh25Bg6G4XnVd8qVDqTaDGaA4L7FBYySDO1 w8AvDJgZ6sNy8Sqvrtb/psSehLvh87gV1XLT+ZC8kChEbqkLEILfMz9ttlr3tOJ8gVyb 1W3Ab2J7UDgwACi0PCiUA+J8UQfUXHxmnR0SkTobE1H4OtcqYMoiUx4wkK2SnZJ1rXPX 9fD03X4v0f84kqtO4F6eVVOscfRYJIYCXhDRBGTJncSWAQwe1z+3ZMXs57ULkReIqFDZ 8Q8w== 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=13SDJ5YJoqXHo0jCWqSfktge4if91YBn7RjHXDUeueo=; b=gSvl3iE+cHpP7BkY54WFLTB6ZQa2r7qj+gi1xBqWv2ySwKgSf5+SGJHFW43jiILDUA CqsZdowpId388nionZ7/rad4/+OSrhhf49zh80RXiBvMOhuWgK79mtK0+jiuvFOiinFM 6dh697GtE/D4GlhE2pYYnVUjkT/BRCC81p5cdh0yAl5GiHuEMv83DcgkvIaKMaoXyXxp I/WyWok92TUZGjFRRmQPeemEDdioGjR3CVInrlr7DNZLasmYJpvniEVzSNHgnzE4Z/UJ R2JklxxStF0wpOHoa7j9SMlaeHAjliHHxLRVpnDB3Hmn9mYhgLSnTV3T02o8gOqO4oA8 H/xQ== 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 k3-v6si16918145plt.233.2018.04.25.03.50.58; Wed, 25 Apr 2018 03:51:13 -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 S1754446AbeDYKsT (ORCPT + 99 others); Wed, 25 Apr 2018 06:48:19 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:53402 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754439AbeDYKos (ORCPT ); Wed, 25 Apr 2018 06:44:48 -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 F141F266; Wed, 25 Apr 2018 10:44:47 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Florian Westphal , Pablo Neira Ayuso Subject: [PATCH 4.14 178/183] netfilter: x_tables: limit allocation requests for blob rule heads Date: Wed, 25 Apr 2018 12:36:38 +0200 Message-Id: <20180425103249.656900927@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180425103242.532713678@linuxfoundation.org> References: <20180425103242.532713678@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: Florian Westphal commit 9d5c12a7c08f67999772065afd50fb222072114e upstream. This is a very conservative limit (134217728 rules), but good enough to not trigger frequent oom from syzkaller. Signed-off-by: Florian Westphal Signed-off-by: Pablo Neira Ayuso Signed-off-by: Greg Kroah-Hartman --- net/netfilter/x_tables.c | 3 +++ 1 file changed, 3 insertions(+) --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -819,6 +819,9 @@ EXPORT_SYMBOL(xt_check_entry_offsets); */ unsigned int *xt_alloc_entry_offsets(unsigned int size) { + if (size > XT_MAX_TABLE_SIZE / sizeof(unsigned int)) + return NULL; + return kvmalloc_array(size, sizeof(unsigned int), GFP_KERNEL | __GFP_ZERO); }