From patchwork Wed May 22 12:07:36 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandre Belloni X-Patchwork-Id: 10955785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA116112C for ; Wed, 22 May 2019 12:08:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C678B28A71 for ; Wed, 22 May 2019 12:08:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B780228B1E; Wed, 22 May 2019 12:08:07 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6BA8C28A71 for ; Wed, 22 May 2019 12:08:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To :From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=OnIcsxPdlbZL8lZtwzQr5gcOojCt+fVgHCTHatOpTQM=; b=K5MUbcvgTVClcF 8MhA6XoOzSj9vf0gi0DrZEYbYYkPZF7MoDv8rWvTyWk3zjVOrDKwGzjo4nxIuddXOZG9XjtHvHi84 Cf6tRMhH5/G+4DrV8qIZzOAij7AVb3qLXRIrn+gzzGImnG+NLqLpSr8L5Z+mgiZsnvKHS7szDkMvx BWXbA6DinCUNYG5nrk4vngx1YsfAPkSASgO/XCIoF927AFZ8AcNNzFOwXcdbrT9nfMPyVIckgrioy l6gDYkPhp22CN44kXkOxPlwBN1nNk0xJEjJvbF3N+DfcYzWDqktSyEs9qTFn1t6llUAcaNbubSvbf gvAlnUlv9yCjod7EWi1w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTQ2K-00028m-1A; Wed, 22 May 2019 12:08:00 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1hTQ2G-00028I-Eb for linux-arm-kernel@lists.infradead.org; Wed, 22 May 2019 12:07:58 +0000 X-Originating-IP: 92.137.69.152 Received: from localhost (alyon-656-1-672-152.w92-137.abo.wanadoo.fr [92.137.69.152]) (Authenticated sender: alexandre.belloni@bootlin.com) by relay4-d.mail.gandi.net (Postfix) with ESMTPSA id 31F87E000A; Wed, 22 May 2019 12:07:45 +0000 (UTC) From: Alexandre Belloni To: Felipe Balbi , Vladimir Zapolskiy , Greg Kroah-Hartman Subject: [PATCH v2] usb: gadget: udc: lpc32xx: allocate descriptor with GFP_ATOMIC Date: Wed, 22 May 2019 14:07:36 +0200 Message-Id: <20190522120736.5521-1-alexandre.belloni@bootlin.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190522_050756_636747_228A9735 X-CRM114-Status: GOOD ( 10.39 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Sylvain Lemieux , linux-arm-kernel@lists.infradead.org, James Grant Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Gadget drivers may queue request in interrupt context. This would lead to a descriptor allocation in that context. In that case we would hit BUG_ON(in_interrupt()) in __get_vm_area_node. Also remove the unnecessary cast. Tested-by: James Grant Signed-off-by: Alexandre Belloni Acked-by: Sylvain Lemieux --- Changes in v2: - remove unnecessary cast as pointed by Joe Perches - Collected tested-by drivers/usb/gadget/udc/lpc32xx_udc.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/usb/gadget/udc/lpc32xx_udc.c b/drivers/usb/gadget/udc/lpc32xx_udc.c index d8f1c60793ed..2719194ebf42 100644 --- a/drivers/usb/gadget/udc/lpc32xx_udc.c +++ b/drivers/usb/gadget/udc/lpc32xx_udc.c @@ -937,8 +937,7 @@ static struct lpc32xx_usbd_dd_gad *udc_dd_alloc(struct lpc32xx_udc *udc) dma_addr_t dma; struct lpc32xx_usbd_dd_gad *dd; - dd = (struct lpc32xx_usbd_dd_gad *) dma_pool_alloc( - udc->dd_cache, (GFP_KERNEL | GFP_DMA), &dma); + dd = dma_pool_alloc(udc->dd_cache, GFP_ATOMIC | GFP_DMA, &dma); if (dd) dd->this_dma = dma;