Skip to content

Commit dda32c0

Browse files
tititiou36gregkh
authored andcommitted
xhci: Do not use GFP_KERNEL in (potentially) atomic context
'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: ddba5cd ("xhci: Use command structures when queuing commands on the command ring") Cc: <[email protected]> Signed-off-by: Christophe JAILLET <[email protected]> Signed-off-by: Mathias Nyman <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 9b6a126 commit dda32c0

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

drivers/usb/host/xhci.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
15141514
* we need to issue an evaluate context command and wait on it.
15151515
*/
15161516
static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
1517-
unsigned int ep_index, struct urb *urb)
1517+
unsigned int ep_index, struct urb *urb, gfp_t mem_flags)
15181518
{
15191519
struct xhci_container_ctx *out_ctx;
15201520
struct xhci_input_control_ctx *ctrl_ctx;
@@ -1545,7 +1545,7 @@ static int xhci_check_maxpacket(struct xhci_hcd *xhci, unsigned int slot_id,
15451545
* changes max packet sizes.
15461546
*/
15471547

1548-
command = xhci_alloc_command(xhci, true, GFP_KERNEL);
1548+
command = xhci_alloc_command(xhci, true, mem_flags);
15491549
if (!command)
15501550
return -ENOMEM;
15511551

@@ -1639,7 +1639,7 @@ static int xhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, gfp_t mem_flag
16391639
*/
16401640
if (urb->dev->speed == USB_SPEED_FULL) {
16411641
ret = xhci_check_maxpacket(xhci, slot_id,
1642-
ep_index, urb);
1642+
ep_index, urb, mem_flags);
16431643
if (ret < 0) {
16441644
xhci_urb_free_priv(urb_priv);
16451645
urb->hcpriv = NULL;

0 commit comments

Comments
 (0)