* [PATCH for 4.4, 4.9 and 4.14] xhci: Do not use GFP_KERNEL in (potentially) atomic context
@ 2021-05-18 3:30 Nobuhiro Iwamatsu
2021-05-20 8:34 ` Greg KH
0 siblings, 1 reply; 2+ messages in thread
From: Nobuhiro Iwamatsu @ 2021-05-18 3:30 UTC (permalink / raw)
To: stable
Cc: gregkh, sashal, Christophe JAILLET, Mathias Nyman, Nobuhiro Iwamatsu
From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
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: <stable@vger.kernel.org>
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Link: https://lore.kernel.org/r/20210512080816.866037-4-mathias.nyman@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
[iwamatsu: Adjust context]
Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
---
drivers/usb/host/xhci.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index bd6e3555c04793..b1994b03341fe8 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1302,7 +1302,7 @@ static int xhci_configure_endpoint(struct xhci_hcd *xhci,
* 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 xhci_hcd *xhci, unsigned int slot_id,
* 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, struct urb *urb, gfp_t mem_flags)
*/
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;
--
2.30.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH for 4.4, 4.9 and 4.14] xhci: Do not use GFP_KERNEL in (potentially) atomic context
2021-05-18 3:30 [PATCH for 4.4, 4.9 and 4.14] xhci: Do not use GFP_KERNEL in (potentially) atomic context Nobuhiro Iwamatsu
@ 2021-05-20 8:34 ` Greg KH
0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2021-05-20 8:34 UTC (permalink / raw)
To: Nobuhiro Iwamatsu; +Cc: stable, sashal, Christophe JAILLET, Mathias Nyman
On Tue, May 18, 2021 at 12:30:35PM +0900, Nobuhiro Iwamatsu wrote:
> From: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>
> 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: <stable@vger.kernel.org>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
> Link: https://lore.kernel.org/r/20210512080816.866037-4-mathias.nyman@linux.intel.com
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> [iwamatsu: Adjust context]
> Signed-off-by: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Now queued up, thanks.
greg k-h
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-05-20 8:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-18 3:30 [PATCH for 4.4, 4.9 and 4.14] xhci: Do not use GFP_KERNEL in (potentially) atomic context Nobuhiro Iwamatsu
2021-05-20 8:34 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).