Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp535997pxj; Tue, 18 May 2021 08:47:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsdQ9JIsLj6VuW3eVHIeGfTiWFO58dS/cLlp7OncMRdqU5+1c43QkHdJ0GK+qRkG9HNL3N X-Received: by 2002:a17:906:5495:: with SMTP id r21mr6816170ejo.471.1621352845589; Tue, 18 May 2021 08:47:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621352845; cv=none; d=google.com; s=arc-20160816; b=zrZm9zS2Qi5aWtkWNpjuWOt3XhPcNRLscKSa/QcbnUmmfmnlHCEJOfXen2PtK+a7CH BYtNmn1WWB5Oqgpof986Y+FPgUgwuTJoXR0Xqi3u23pieZt9d2DrkZ2pmD/0FDHPXRg6 DlwyyE5BLuKAv/6rcnZq9pzbVyNbq5zwIV6Vo2Br+rQPOlsTVahI3pttw69RlyCwaP/s QCp/nO/HRxHwo90nv8BvFeNcFWz0nrhq3N/DlbbTezIQqYZk04FrtkQvDD0P6O/DQ9Mo HJ+1S6xpFCshXDqL2BW8Ox51iUQOCYc7N5VVaWs3fpgH7zW3+rJopl4UOKLr9JKmzqMv oQqQ== 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=G55V8O9u0Ri9fKh2MoHnPMVy6GVOgt0dnB7FWW5mAdE=; b=ik0pbOkSNJbE8Dfeih6KJpjmhfSw+ER1rOx1wQfrt1bIRLPRz4IZxuaUzDCC7tqHtL l1pbrx0KOJETIPduMpT9HjvogEoi6QHMT6oBd6BixcmSFRqs4nQOxtqw4uLp9IZsws4I nvjPR84QHAWObsJwimtWp3oTxndKJMtJxMELjDLo+d53JDZ+emTK6UBil9lIqMq5vIWb yudD6rW3sD1YokqnEFe4RVmsWBOhu6mBMqazAV1JY/kmAkHECqlLXvFeerc3ncEdDdnI jHdTRdZWUXPLvXM4dmCgrBvSltCRELaRlznF8oCaC2XfvRAWEECBKKjCwuNhWdXInirQ jrog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=AADbERNX; 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 g14si221876ejc.707.2021.05.18.08.46.41; Tue, 18 May 2021 08:47:25 -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=AADbERNX; 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 S1345683AbhEQP5K (ORCPT + 99 others); Mon, 17 May 2021 11:57:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:38868 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244422AbhEQPiB (ORCPT ); Mon, 17 May 2021 11:38:01 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 7E08661CE4; Mon, 17 May 2021 14:40:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262438; bh=2ARL+2UgrlN+3NXZaDHjsu/UBaTUogZITmBNNfaunro=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AADbERNXbjv4gDLu6OwvkDDb+TRn9lDLVnrbop8nzDRhHbgSoc4EoCkN7Pq5arGYY pFl17LVw8qse8gezyNPvMFREthW3ilL7WVy3T2ljpKle3aMsIRkj0e58N0mImOpXQV 6mnfdx4LPlKKlgi7aONUnxCLD0WZ/g2a6/Ix0SCY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christophe JAILLET , Mathias Nyman Subject: [PATCH 5.11 291/329] xhci: Do not use GFP_KERNEL in (potentially) atomic context Date: Mon, 17 May 2021 16:03:22 +0200 Message-Id: <20210517140311.945996834@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140302.043055203@linuxfoundation.org> References: <20210517140302.043055203@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 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 @@ -1523,7 +1523,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; @@ -1554,7 +1554,7 @@ static int xhci_check_maxpacket(struct x * changes max packet sizes. */ - command = xhci_alloc_command(xhci, true, GFP_KERNEL); + command = xhci_alloc_command(xhci, true, mem_flags); if (!command) return -ENOMEM; @@ -1648,7 +1648,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;