From patchwork Thu Mar 10 18:58:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris J Arges X-Patchwork-Id: 595931 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id 38A7A140779; Fri, 11 Mar 2016 05:58:53 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1ae5nK-0000F8-W1; Thu, 10 Mar 2016 18:58:46 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.76) (envelope-from ) id 1ae5nG-0000Ez-HZ for kernel-team@lists.ubuntu.com; Thu, 10 Mar 2016 18:58:42 +0000 Received: from 1.general.arges.us.vpn ([10.172.65.250] helo=localhost.localdomain) by youngberry.canonical.com with esmtpsa (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1ae5nF-0002Pq-WC for kernel-team@lists.ubuntu.com; Thu, 10 Mar 2016 18:58:42 +0000 From: Chris J Arges To: kernel-team@lists.ubuntu.com Subject: [SRU][Wily][PATCH] UBUNTU: SAUCE: (noup) netfilter: x_tables: check for size overflow Date: Thu, 10 Mar 2016 12:58:37 -0600 Message-Id: <1457636317-13541-1-git-send-email-chris.j.arges@canonical.com> X-Mailer: git-send-email 2.7.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: kernel-team-bounces@lists.ubuntu.com From: Florian Westphal BugLink: http://bugs.launchpad.net/bugs/1555353 http://marc.info/?l=netfilter-devel&m=145757136822750&w=2 Ben Hawkes says: integer overflow in xt_alloc_table_info, which on 32-bit systems can lead to small structure allocation and a copy_from_user based heap corruption. Reported-by: Ben Hawkes Signed-off-by: Florian Westphal Signed-off-by: Tim Gardner Signed-off-by: Chris J Arges --- net/netfilter/x_tables.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/netfilter/x_tables.c b/net/netfilter/x_tables.c index d324fe7..7884241 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -661,6 +661,9 @@ struct xt_table_info *xt_alloc_table_info(unsigned int size) struct xt_table_info *info = NULL; size_t sz = sizeof(*info) + size; + if (sz < size || sz < sizeof(*info)) + return NULL; + /* Pedantry: prevent them from hitting BUG() in vmalloc.c --RR */ if ((SMP_ALIGN(size) >> PAGE_SHIFT) + 2 > totalram_pages) return NULL;