Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp3560303pxb; Mon, 1 Mar 2021 13:21:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJys3zVVfrtPXkjatMNMbgsDpHcdK53BHg92JCWv5wQHA6TftHq4u+ea04C7863ZU0P6GvoN X-Received: by 2002:a05:6402:31b7:: with SMTP id dj23mr18393359edb.245.1614633705919; Mon, 01 Mar 2021 13:21:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614633705; cv=none; d=google.com; s=arc-20160816; b=GNPhA/bBSLWK7dzpm5n2DzXKroDn/JhUq6W1LBU9KAemEqSDgDvMrngpZ7U6no7MHM MVG9ApBbqG3TWHH9cReDS9wPD7pd9d97oDCzWgJ4CTKxPLohPUjfhlDQ1BH96uXt4PEL UK/WyU2oJbK3YpxnTK5SpFUz43GFgW7rDW5iJLbU5Fkfloh9HZZqmGMS4NgZVrpb355+ yXw9KKBIVEYDxzWf/IvAL1pRw98vYijtAfJzIkq1AA/64XvUVRKWnRfcE5mWYVaZAg3d CLXct88Qt42RIZGeK65nlAXC1gwxkbGlY5Zq/+KlT7bgGrHDg2oCbWMWICup3T0wBnfb YlHw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ZFEbH/m5kj77UijWRIGkFlJFqxzu7htsi1ecvy3TCE0=; b=GTdHnt4rm58nnDmM6WO0icQHwmVj6OKYBP0ZkX/KMhqAjmnhGFMNyCCppJnZT0Jb7p KeCRzEqFvFx7og+F7UIoBsZjp55RSrvoLSIS+/lCmViP6U2yFIlDe++xYoqHKbLbZYb7 2c2B5ZvHxdy76zRAojFjOuf+gtfFWDfutWxe6OBZiw/m3VQFVTa80O9XyiIE3JFmZCy9 mkCgoM6m9vVa/uw4Mf762nsWjNDMAwax/RMPJXH/UodrfRuAbOI48U36eZwh7xVvIQ3P cI8EzdugptNuhvqXOg5OP4biH/gD/vZ19P6isoK0YNf9ml/8/0JEN/k8hstASywnNtNy b1dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V5tTZnnz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c12si13164432eja.386.2021.03.01.13.21.23; Mon, 01 Mar 2021 13:21:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=V5tTZnnz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244268AbhCAVSm (ORCPT + 99 others); Mon, 1 Mar 2021 16:18:42 -0500 Received: from mail.kernel.org ([198.145.29.99]:46318 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233061AbhCAROC (ORCPT ); Mon, 1 Mar 2021 12:14:02 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 4BEEC64F46; Mon, 1 Mar 2021 16:45:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1614617123; bh=6jbua2UHxglhLLVTcJHBXmMy+TvtkbpIqWQxKJ7beZU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5tTZnnz5GA8SDsO32Blys/v1fUtm3L6zKSVoUZq1jZ817ICLqdJrfb0AftdxJXRw itbXbZVjN43tuSfIj8eMLzTMny9HEz7ErznRC6cMycXZoFv7OpiNYx1uQpIDOzPa3Z KLG1Rk2H+c4/Ys45mAsPP/x53HjPsF9ectPv9/vY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dan Carpenter , Amey Narkhede Subject: [PATCH 4.19 210/247] staging: gdm724x: Fix DMA from stack Date: Mon, 1 Mar 2021 17:13:50 +0100 Message-Id: <20210301161041.958899544@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210301161031.684018251@linuxfoundation.org> References: <20210301161031.684018251@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Amey Narkhede commit 7c3a0635cd008eaca9a734dc802709ee0b81cac5 upstream. Stack allocated buffers cannot be used for DMA on all architectures so allocate hci_packet buffer using kmalloc. Reviewed-by: Dan Carpenter Signed-off-by: Amey Narkhede Link: https://lore.kernel.org/r/20210211053819.34858-1-ameynarkhede03@gmail.com Cc: stable Signed-off-by: Greg Kroah-Hartman --- drivers/staging/gdm724x/gdm_usb.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) --- a/drivers/staging/gdm724x/gdm_usb.c +++ b/drivers/staging/gdm724x/gdm_usb.c @@ -56,20 +56,24 @@ static int gdm_usb_recv(void *priv_dev, static int request_mac_address(struct lte_udev *udev) { - u8 buf[16] = {0,}; - struct hci_packet *hci = (struct hci_packet *)buf; + struct hci_packet *hci; struct usb_device *usbdev = udev->usbdev; int actual; int ret = -1; + hci = kmalloc(struct_size(hci, data, 1), GFP_KERNEL); + if (!hci) + return -ENOMEM; + hci->cmd_evt = gdm_cpu_to_dev16(udev->gdm_ed, LTE_GET_INFORMATION); hci->len = gdm_cpu_to_dev16(udev->gdm_ed, 1); hci->data[0] = MAC_ADDRESS; - ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), buf, 5, + ret = usb_bulk_msg(usbdev, usb_sndbulkpipe(usbdev, 2), hci, 5, &actual, 1000); udev->request_mac_addr = 1; + kfree(hci); return ret; }