From patchwork Thu Mar 10 15:38:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Gardner X-Patchwork-Id: 595822 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 C97A81402A1; Fri, 11 Mar 2016 02:39:14 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical-com.20150623.gappssmtp.com header.i=@canonical-com.20150623.gappssmtp.com header.b=dIbwfJGA; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1ae2g5-0005PY-OE; Thu, 10 Mar 2016 15:39:05 +0000 Received: from mail-ig0-f182.google.com ([209.85.213.182]) by huckleberry.canonical.com with esmtps (TLS1.0:RSA_ARCFOUR_SHA1:16) (Exim 4.76) (envelope-from ) id 1ae2g1-0005PN-42 for kernel-team@lists.ubuntu.com; Thu, 10 Mar 2016 15:39:01 +0000 Received: by mail-ig0-f182.google.com with SMTP id av4so21618462igc.1 for ; Thu, 10 Mar 2016 07:39:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id; bh=RLCe5hGe+6Gd43+ClkKVh0HYGpSq+ga0S8/U9XpUt9w=; b=dIbwfJGAMfRTrjORfQnvDkxqpopCP7+BjDVNhiishq2DGnthKD5wmjNaHszbz7Qhjo O0+fV9PDpqA4wR7rgji5UFgETep81SGMVDd+X0ie014w9Xezrvavze9+2TOi9hfEQzjn F5u31V3hYtPpQE6PcX93W5U9dnFG7m/EQt3uLI5rKjlc+wzd5lQjCKxaE0/ymzKrYiIu c+ZwEU/0b1JkRgZ+oYZeyCfqVqvVn7AhhjEkkkdRf7VscY8zSXlPLawNkrUwkFclicP8 e+Z0OOUJLT+V4k1jf+G+rYIfu53ZSd9JYu8ER/8WmRmfle3JekS6dR5u3ancr0Y2wOth 2+iQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id; bh=RLCe5hGe+6Gd43+ClkKVh0HYGpSq+ga0S8/U9XpUt9w=; b=X1wzwkyvQ8VqjB7NymUEnGlVuJYdK2xnxsOxUXwqDdnYCWsL1G3uUKsbcowBudMDBS OPmiJMHLrSLATv3yE8i72ZwqFC8oLTfoQ3BdUlS20g22omF68ROlSShKfv3rJiva8ec0 EpVz4FvM3cAx0CXtOkIOcv1ylkIVV9NnlifwgIwNkKi79i6g9zuoswMDj+Y1qFrbUr4I U1HYVh7WKiRQN+10OdlvSdF/Ld6GXh5rRdxc/uJBqvMVm8rDzkvAIBSbnJH+hU4klCj+ l6duWdzj7K3Z6z6zLoM2LFzgyJYdPWG1of+Fl35PXodc7xZiJjAsWWBU/PQQLlX2MPMy aghw== X-Gm-Message-State: AD7BkJLDCKTjD2Nxxt+fIA4KabAeLM3jx1+QWUg1XCMAMPYQ4ATjFglG0BIDUuJnlXA/Oc08 X-Received: by 10.50.138.72 with SMTP id qo8mr4449728igb.81.1457624339940; Thu, 10 Mar 2016 07:38:59 -0800 (PST) Received: from localhost.localdomain (host-98-127-250-84.bln-mt.client.bresnan.net. [98.127.250.84]) by smtp.gmail.com with ESMTPSA id 12sm1650329iog.21.2016.03.10.07.38.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 10 Mar 2016 07:38:59 -0800 (PST) From: tim.gardner@canonical.com To: kernel-team@lists.ubuntu.com Subject: [PATCH Wily SRU] UBUNTU: SAUCE: netfilter: x_tables: check for size overflow Date: Thu, 10 Mar 2016 08:38:57 -0700 Message-Id: <1457624337-22326-1-git-send-email-tim.gardner@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 --- 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 d4aaad7..865cf73 100644 --- a/net/netfilter/x_tables.c +++ b/net/netfilter/x_tables.c @@ -658,6 +658,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;