Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp640534pxj; Thu, 20 May 2021 18:42:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcknWhCtDLGwseYx7KBp0WAPZ0zUS6SdAExRuPAfi0d3K+ewXGpOx1vbNj0cVBNP/uj/d+ X-Received: by 2002:a17:906:f283:: with SMTP id gu3mr7476467ejb.91.1621561358147; Thu, 20 May 2021 18:42:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621561358; cv=none; d=google.com; s=arc-20160816; b=j8oQFdz5ea7hHMWtLPM9ifhMkg6G/e5kM7E/YmC3Sb2ppFL23rx1MOuWtc85eCPN1U bIT5l9tvBpu5+29mMLN2XWsiBRP/hM78isre1uq3a3UapRy1erWHfqVnhSMqR83gbtwI ZvzH9Llz7/bf6SedRC0QydkauVADcuScAYaKVnZ4W1Ddz4pxijRWgKUoIC30rlz5f1+2 cmDbxQbRqfeglxsPt98OrZ0mA1dgnV8aLAg+NR1mgG3dvGI3SvjrNH/70cFAPTmYPgx/ RKSCbYXdungvyvbej4JUhQuQ0Qdn21GpQ1Ye9KB6uHLXOjJ6wGO94wHn/fr+1ZUaBaiQ 5BqA== 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=t9cjXM4G2ebPg7HdUh+KkaFqz2skHlcbdEIo0QTkF/M=; b=VOXcIlO5Z+8rMLqnjqlPCcLKEzjqJGRa9q7zQZxWzTMhJ1pq1IGtlmljQSoDfaDPrY 5EdpkR5Qfx/US7pPLbG05bLjpAkL7aVPOEZNvspXUgv94YmaKc/+1sziH2d3IviI45WJ hgabrsH1Q1BJ+EhNO1pFeDalycxC1vra4S2jPR6PBeXdfUuwaLQUqGYoP9Pp2Bp5JFHz aTeN+bqrzoNMWK3Geykah/+9y+BsjU07cXzB3mIgOrx3e1K7j5nlVQCRX+9WseFg3M+z Wrv6Ru+22asI5ojicft3cZlIeTs3AuYrRcMLqmkyxclT2rcmY9ZN+Uev6LMMejssl+KV TFYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=RyALVIi3; 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 n3si3520807edo.13.2021.05.20.18.42.15; Thu, 20 May 2021 18:42:38 -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=RyALVIi3; 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 S242786AbhETLrf (ORCPT + 99 others); Thu, 20 May 2021 07:47:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:44408 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241672AbhETLZS (ORCPT ); Thu, 20 May 2021 07:25:18 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 986066196E; Thu, 20 May 2021 10:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621505573; bh=Dp6o75Ff8MqXtSUbmpR2f9jwiirqVvPfWwHj8OA9CP0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RyALVIi3q2kCQxlUO8Zeo7H1/T3jssz4QdkK+NO59IG16nZXmwNqRV2zRIpV7/jzj 7jl9jyTNRXEeZd23/JbeNBA5U3uS13kEOL3khkR1ylAnFY8hnsebanXT5pGKIULIKM SW/nHOOiSqIWNSaecj4Iy96lxPdeh7KPxIxQEWTQ= 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.4 189/190] xhci: Do not use GFP_KERNEL in (potentially) atomic context Date: Thu, 20 May 2021 11:24:13 +0200 Message-Id: <20210520092108.415487606@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210520092102.149300807@linuxfoundation.org> References: <20210520092102.149300807@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 @@ -1302,7 +1302,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; @@ -1333,7 +1333,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; @@ -1440,7 +1440,7 @@ int xhci_urb_enqueue(struct usb_hcd *hcd */ 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;