From patchwork Sat Apr 22 10:14:58 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Malcolm Priestley X-Patchwork-Id: 9694341 X-Patchwork-Delegate: kvalo@adurom.com 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 9E0636038E for ; Sat, 22 Apr 2017 10:15:31 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 916DF26490 for ; Sat, 22 Apr 2017 10:15:31 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8671128521; Sat, 22 Apr 2017 10:15:31 +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=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 28E4128304 for ; Sat, 22 Apr 2017 10:15:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422773AbdDVKP1 (ORCPT ); Sat, 22 Apr 2017 06:15:27 -0400 Received: from mail-wm0-f68.google.com ([74.125.82.68]:35568 "EHLO mail-wm0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1043800AbdDVKPY (ORCPT ); Sat, 22 Apr 2017 06:15:24 -0400 Received: by mail-wm0-f68.google.com with SMTP id d79so8902484wmi.2; Sat, 22 Apr 2017 03:15:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=43bGMd2pmtWYityyntpw0aQcub587eXt5VYze3oxb6M=; b=nfj5xZbqkw6KrCSWjuCptDPuYLmTN9Ft6BAAOu2KAb4pQeJvMyLQyhX27osHbyVmPS atkJM4YfKlNmeqabWk9GDohS2T7hqb1OK8F3Np9GvUjYPwrgWJQrH5Vuni3yrslMXisC 3P1M0KDlOT+nUrKKV36nmCgBcWuF4JzBzABoTPnvOEzcE2rlf9p1xbYpjRjMJXroSKYo 9znImFAGc8acJkQ15QGM6hgU669eSjtb4GA/J0NtTMDQygNiOit+NMY2t0TXa7/2Ow0E beSBnBF5Tw2CuFNlRSn/ofB5UoKfkI7AwAxWuDq8mzkg6l5q1tzo1jITBJEaKyflaclM 8O1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=43bGMd2pmtWYityyntpw0aQcub587eXt5VYze3oxb6M=; b=HHDQIvyB72JBqieRQFVluUQN3N9/VlCIbqLazlyc+tflUHjNzlIFbdOxs7fc23Dnq2 ERUK0kv3JtbDrrQp3WI1C48iYUEDPAvdPkkGGXMI8iPL5zsLnucgEjvgz3Y0N/FELh+4 DpnTXnrnhFjqLcOMXjJS4D/VUfFBXWMBCWe3Q+6Uox+VLXXZ9XtrzjahSAPR6xQWIYCE wSEVFY8VImUks+x0OGaU5k2tr+bNZd/gQh8yGnAMoE+l+03/mwTy/xujKzJd4RDszjvk 5PPTDZ2x9SnalbYJT0DYnLFmn14Q1IoTA0D8jBIeAJoB8p4Hi3j9C1d9N8gICtd/CrKN UVrw== X-Gm-Message-State: AN3rC/71dEP6SeBtMTLyhJLoMPUWXO/dF7E8Q0cgEPSAQb2C3AxKIrwo R3Eqv0TjMLqUyw== X-Received: by 10.28.94.9 with SMTP id s9mr2446824wmb.17.1492856122623; Sat, 22 Apr 2017 03:15:22 -0700 (PDT) Received: from localhost.localdomain (94.197.121.138.threembb.co.uk. [94.197.121.138]) by smtp.gmail.com with ESMTPSA id k63sm5414010wmf.9.2017.04.22.03.15.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 22 Apr 2017 03:15:22 -0700 (PDT) From: Malcolm Priestley To: gregkh@linuxfoundation.org Cc: linux-wireless@vger.kernel.org, devel@driverdev.osuosl.org, Malcolm Priestley , "# v4 . 9+" Subject: [PATCH 2/2] staging: vt6656: use off stack for in buffer USB transfers. Date: Sat, 22 Apr 2017 11:14:58 +0100 Message-Id: <20170422101458.4566-2-tvboxspy@gmail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170422101458.4566-1-tvboxspy@gmail.com> References: <20170422101458.4566-1-tvboxspy@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Since 4.9 mandated USB buffers to be heap allocated. This causes the driver to fail. Create buffer for USB transfers. Signed-off-by: Malcolm Priestley Cc: # v4.9+ --- drivers/staging/vt6656/usbpipe.c | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/usbpipe.c b/drivers/staging/vt6656/usbpipe.c index ea5a7c65ad1b..dc11a05be8c4 100644 --- a/drivers/staging/vt6656/usbpipe.c +++ b/drivers/staging/vt6656/usbpipe.c @@ -85,15 +85,28 @@ int vnt_control_in(struct vnt_private *priv, u8 request, u16 value, u16 index, u16 length, u8 *buffer) { int status; + u8 *usb_buffer; if (test_bit(DEVICE_FLAGS_DISCONNECTED, &priv->flags)) return STATUS_FAILURE; mutex_lock(&priv->usb_lock); + usb_buffer = kmalloc(length, GFP_KERNEL); + if (!usb_buffer) { + mutex_unlock(&priv->usb_lock); + return -ENOMEM; + } + status = usb_control_msg(priv->usb, - usb_rcvctrlpipe(priv->usb, 0), request, 0xc0, - value, index, buffer, length, USB_CTL_WAIT); + usb_rcvctrlpipe(priv->usb, 0), + request, 0xc0, value, + index, usb_buffer, length, USB_CTL_WAIT); + + if (status == length) + memcpy(buffer, usb_buffer, length); + + kfree(usb_buffer); mutex_unlock(&priv->usb_lock);