From patchwork Fri Mar 9 05:55:35 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tobin Harding X-Patchwork-Id: 10269745 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 3938160236 for ; Fri, 9 Mar 2018 05:56:04 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2378129BE8 for ; Fri, 9 Mar 2018 05:56:04 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D8029C26; Fri, 9 Mar 2018 05:56:04 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.3 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 35EFF29BE8 for ; Fri, 9 Mar 2018 05:56:02 +0000 (UTC) Received: (qmail 29698 invoked by uid 550); 9 Mar 2018 05:56:00 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 28625 invoked from network); 9 Mar 2018 05:55:59 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tobin.cc; h=cc :date:from:message-id:subject:to:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=QY06K6EQ6o4/duIPA9cWlBXKOeVXi7ZpJqfv63l7A J8=; b=styyVnSsepCD71SjD2y/gHwTHJy3WnyGs69tzzwF8UYCBCjomjQlig+Pp B8WoblEJmoBI7MsxdFg4NlzulydDCrKQmUZkn69tHR1bCvTp6WENWKMJ1Tog8Oen mhsBTPgPswuqg1Vme7QhGfO7hiPOOfyyyedM4TNUbWK+QgvvAFLg+7i6j19pXLRs PJhONMgyKA/1Cf2QhjDuScUPl9boegPd40r0LR9s+44EJxzurwR3nz2QCRRxagRB YkS59OIzsCsdpxso6kIgGJokkFj44+s1g9pVAkHmRTp1x3DWpccLLLi66z6t6f4f SYGDsWnUE6gPnfrnPEU6evpKaGHcw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:message-id:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=QY06K6EQ6o4/duIPA 9cWlBXKOeVXi7ZpJqfv63l7AJ8=; b=IA6/nTatvx7wLswv6X490QHr8ulKVmtLe sY+kmDkObplfIZ5zj4FWY88plSnvoSqvq5JBXgy6QwOpuNl3eB58xgzKRXTe9bz8 GG25bRdDc0Sy8vNphhBhfMyALr7pzRrqSw8ARlnAA5WlP1SfpvgM4FPy6WF+ieTZ TaQAlNFv375ck+A2R0tRqML17dFHnaAXQHBGNC3XnEIueKugCJUwkyywkbk1uSHO S0/AAKy/GaBB/oEcpxna/qtQsOCyG/7BXX8dh9yWnxqv/QoI1R9y4MdL/uifXlSi 5SO79V89EjNI1VYnKAe1uVJRijWdLI0vhYUcwG06z4lv0lvr2KVsg== X-ME-Sender: From: "Tobin C. Harding" To: Greg Kroah-Hartman Cc: "Tobin C. Harding" , kernel-hardening@lists.openwall.com, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Tycho Andersen , Kees Cook , Felipe Balbi , Alan Stern Subject: [PATCH 3/4] usb: Remove stack VLA usage Date: Fri, 9 Mar 2018 16:55:35 +1100 Message-Id: <1520574935-7457-1-git-send-email-me@tobin.cc> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: Tobin C. Harding --- drivers/usb/misc/usbtest.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/usb/misc/usbtest.c b/drivers/usb/misc/usbtest.c index 90028ef541e3..9e1142b8b91b 100644 --- a/drivers/usb/misc/usbtest.c +++ b/drivers/usb/misc/usbtest.c @@ -2028,11 +2028,14 @@ test_queue(struct usbtest_dev *dev, struct usbtest_param_32 *param, unsigned i; unsigned long packets = 0; int status = 0; - struct urb *urbs[param->sglen]; + struct urb *urbs[MAX_SGLEN]; if (!param->sglen || param->iterations > UINT_MAX / param->sglen) return -EINVAL; + if (param->sglen > MAX_SGLEN) + return -EINVAL; + memset(&context, 0, sizeof(context)); context.count = param->iterations * param->sglen; context.dev = dev;