Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp648438pxj; Tue, 18 May 2021 11:00:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzMIebBWR5gyDLNFWoDKd8CW20xX50HDsGqzSnPZq+02nrTV+t9BPz7v17dkVzY6VdLqNxz X-Received: by 2002:a6b:e719:: with SMTP id b25mr5064420ioh.49.1621360823324; Tue, 18 May 2021 11:00:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621360823; cv=none; d=google.com; s=arc-20160816; b=0o07ICpMCQL3VaZ6ShhSuRTynvZQ5/wKO/Z6ecpGr6QhJSX7Tojci/3cbTZqjxrOoM VBUtLRfAT0ZmOpTeBT9KfKiPGWxj1V0J+q2y6IPukTVcjvqB9SihsZ/PV/hUa4kkGR4E 5lSi6iYytDhZrO9HgeRRbQ8Kcn4OBZVbYG/SWU1CzpqPEnqlTbZupJaBpoaewgl/rmLK nUNT/Gdo9tCvyZitkpb0+wPkiuBbdfLc+kVWIlimBFdQkBQp0MoI8WkCSOSYEZWURA21 JJIAHSp0ZHuh5DdzVMnXff6v5XIZbNAyLyEXPe+eYpLu6p20R2DuwqeYLrGRVmzF6KPK D3zg== 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=w6smJA4cZaUqo/8wxv7pkaruh59XQiJtmDqcqwhPtWY=; b=bx8JwbGbLhqgwm94a1VltPgjzAzEZ6IHOdE+jbFSx0yU2idn4kfZdTC4O4NcRRJR9S xUuHljVlAQvp1NYEP+U43JT6eLHhxeXtxuuP+kbq/p0iuo/x1fl+AknAiS1Nq+NaYwfk 7aprHajj3suLgW43uI9yxkWrt7rJkii/+aXQffkMouW0Mgm5JtzuCSfMlz5XVG9fzk0i ZKFiW6+YCu6iuk6dUTLkb0b0aBSXkFq1Z9Bt/tTQWgyCGUUfz3s5yMZ9mRh4x/YoK4ru GrgkANvRzCzT84rBQP4RjBUkwT9VLBIWAbjWDt7A2dZ2krG152B3V3XtSrT3QE8EOfpP 57Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EpztEv9X; 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 g6si248464ila.98.2021.05.18.10.59.44; Tue, 18 May 2021 11:00:23 -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=EpztEv9X; 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 S1346804AbhEQQJ7 (ORCPT + 99 others); Mon, 17 May 2021 12:09:59 -0400 Received: from mail.kernel.org ([198.145.29.99]:35612 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345033AbhEQPqO (ORCPT ); Mon, 17 May 2021 11:46:14 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id DCB2961952; Mon, 17 May 2021 14:44:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1621262659; bh=cePfU9NcGXdJAeLEHSy5JpFozNTh5JcfXlp8E8gVRK8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EpztEv9X8OyGFomXs+bLnb3m4QCG0cmDu222n+4udUf1pJwz0RzPKvDVl2uTt29WH bMCZg8IokGKifvyFg1s0oTTbk/qh51txrU8beB/3rKn36KPevkGGqdoLhAAfKOqq9+ ZDy+I3s/uwpfaeCvSzRpDimv40kGZYH0P0Ki58EQ= 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.10 250/289] xhci: Do not use GFP_KERNEL in (potentially) atomic context Date: Mon, 17 May 2021 16:02:55 +0200 Message-Id: <20210517140313.564179487@linuxfoundation.org> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210517140305.140529752@linuxfoundation.org> References: <20210517140305.140529752@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 @@ -1397,7 +1397,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; @@ -1428,7 +1428,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; @@ -1524,7 +1524,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;