Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp36346pxj; Thu, 20 May 2021 04:02:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk+N7902FJm+j9qM7Zi2Sc+VOxGeBiZavON6pxb4JnXFxIYlOntRePGpIyuIMfGAYJd7vN X-Received: by 2002:a17:906:755:: with SMTP id z21mr4030554ejb.113.1621508562871; Thu, 20 May 2021 04:02:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621508562; cv=none; d=google.com; s=arc-20160816; b=wfv95l/JAfzgcuOnpylmgNbqNDPe9HJgW18nfRqd0NJmW3Ts7bjgVd1Y5yuaMUBbCo /O8jR6UjJayA7vL5Pw5qtfUewAAvWgkSIzR+NRUbRoNuBmy9bblECpFKDwZckhhujM7W W9CwKup4WsSQkrOElOwmZe2DsQA1mFziK/D2GBssJzBbHPI/prMRYxoxTZRBR/Bzmv03 dlx9Tx820i6joRIGFxW+EywsC5QumJyyc6bGiipQfgJ28m5/YuOFpdymZM0eAPPmUAUB rCJx+Hmy3IfEAMJEgkREWlul8pCrrdOSCD3/Nu3OF1+C47cuQvYtuYouS0tRDONAWnmA CPYw== 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=nES0OnClUDv2ook4S9455qIJyULTNgNpeXasjqy7QFQ=; b=ftsFMxem0a4HsiCYKlUixfnrazlSBnhAj9n4OXEVB3nYgOcUIkTayIHLO2F3yBxRSb A4q6+MQqZYt4WC+MnZ7LQ4JVk6yhEsKz85upzCd3nC9w78JlMNITQ9+4ySuK8hkZSJI/ VMXfhkvTO+BA9RvfJIKk4Ewgtf44FZxke5sDJsB9OiayLm3G2Xe8cxrnkYF25ctOpguK /N20R67kfkQZT11i4qzTt5pz589gTmvJesq1RcPfCg9YDqpC/DfxV/HTRo65ufHYD/QH ettD7LtoQhafEoW9tdl2ofsQ4Ifpiml7QF07PAl+KcIhCKsW+I5zB4ShDjz9Vxt5uYRq ez4A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=cH+woGps; 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 y21si2263803ejp.635.2021.05.20.04.02.17; Thu, 20 May 2021 04:02:42 -0700 (PDT) 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=cH+woGps; 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 S237360AbhETLBS (ORCPT + 99 others); Thu, 20 May 2021 07:01:18 -0400 Received: from mail.kernel.org ([198.145.29.99]:44328 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237760AbhETKnR (ORCPT ); Thu, 20 May 2021 06:43:17 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 5FE9661414; Thu, 20 May 2021 09:56:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621504604; bh=zf2nZ4cfnZE8964Msbi+8UbGtmVg6ZoKboWmC1HlK94=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=cH+woGps/oeBEV04bIx4QUzexbnOkcYDbdJT5DjAXmeeieFHmLCCU8iw5fxyJ/ASU giY4mo2SGio2hGlm85MkzqdQOmJ8BozEpnjSceDouvRBtnRwYO7Z/KzaFZtpqZbnET lbktEvyIrrSAhufGQC/bxdYwMlEC5MjkpMAu108Y= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mathias Nyman , Nobuhiro Iwamatsu Subject: [PATCH 4.14 322/323] xhci: Do not use GFP_KERNEL in (potentially) atomic context Date: Thu, 20 May 2021 11:23:34 +0200 Message-Id: <20210520092131.280369939@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092120.115153432@linuxfoundation.org> References: <20210520092120.115153432@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: Christophe JAILLET commit dda32c00c9a0fa103b5d54ef72c477b7aa993679 upstream. 'xhci_urb_enqueue()' is passed a 'mem_flags' argument, because "URBs may be submitted in interrupt context" (see comment related to 'usb_submit_urb()' in 'drivers/usb/core/urb.c') So this flag should be used in all the calling chain. Up to now, 'xhci_check_maxpacket()' which is only called from 'xhci_urb_enqueue()', uses GFP_KERNEL. Be safe and pass the mem_flags to this function as well. Fixes: ddba5cd0aeff ("xhci: Use command structures when queuing commands on the command ring") Cc: Signed-off-by: Christophe JAILLET Signed-off-by: Mathias Nyman Link: https://lore.kernel.org/r/20210512080816.866037-4-mathias.nyman@linux.intel.com [iwamatsu: Adjust context] Signed-off-by: Nobuhiro Iwamatsu Signed-off-by: Greg Kroah-Hartman --- drivers/usb/host/xhci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -1308,7 +1308,7 @@ static int xhci_configure_endpoint(struc * we need to issue an evaluate context command and wait on it. */ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id, - unsigned int ep_index, struct urb *urb) + unsigned int ep_index, struct urb *urb, gfp_t mem_flags) { struct xhci_container_ctx *out_ctx; struct xhci_input_control_ctx *ctrl_ctx; @@ -1339,7 +1339,7 @@ static int xhci_check_maxpacket(struct x * changes max packet sizes. */ - command = xhci_alloc_command(xhci, false, true, GFP_KERNEL); + command = xhci_alloc_command(xhci, false, true, mem_flags); if (!command) return -ENOMEM; @@ -1430,7 +1430,7 @@ static int xhci_urb_enqueue(struct usb_h */ if (urb->dev->speed == USB_SPEED_FULL) { ret = xhci_check_maxpacket(xhci, slot_id, - ep_index, urb); + ep_index, urb, mem_flags); if (ret < 0) { xhci_urb_free_priv(urb_priv); urb->hcpriv = NULL;