* [PATCH 09/10] xhci: don't create endpoint debugfs entry before ring buffer is set.
[not found] <20200918131752.16488-1-mathias.nyman@linux.intel.com>
@ 2020-09-18 13:17 ` Mathias Nyman
2020-09-21 12:54 ` Sasha Levin
0 siblings, 1 reply; 2+ messages in thread
From: Mathias Nyman @ 2020-09-18 13:17 UTC (permalink / raw)
To: gregkh; +Cc: linux-usb, Mathias Nyman, stable
Make sure xHC completes the configure endpoint command and xhci driver
sets the ring pointers correctly before we create the user readable
debugfs file.
In theory there was a small gap where a user could have read the
debugfs file and cause a NULL pointer dereference error as ring
pointer was not yet set, in practise we want this change to simplify
the upcoming streams debugfs support.
Fixes: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver")
Cc: stable@vger.kernel.org #v4.19+
Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com>
---
drivers/usb/host/xhci.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 4cfb95104c26..e88f4f953995 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -1918,8 +1918,6 @@ static int xhci_add_endpoint(struct usb_hcd *hcd, struct usb_device *udev,
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index);
trace_xhci_add_endpoint(ep_ctx);
- xhci_debugfs_create_endpoint(xhci, virt_dev, ep_index);
-
xhci_dbg(xhci, "add ep 0x%x, slot id %d, new drop flags = %#x, new add flags = %#x\n",
(unsigned int) ep->desc.bEndpointAddress,
udev->slot_id,
@@ -2952,6 +2950,7 @@ static int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
xhci_check_bw_drop_ep_streams(xhci, virt_dev, i);
virt_dev->eps[i].ring = virt_dev->eps[i].new_ring;
virt_dev->eps[i].new_ring = NULL;
+ xhci_debugfs_create_endpoint(xhci, virt_dev, i);
}
command_cleanup:
kfree(command->completion);
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 09/10] xhci: don't create endpoint debugfs entry before ring buffer is set.
2020-09-18 13:17 ` [PATCH 09/10] xhci: don't create endpoint debugfs entry before ring buffer is set Mathias Nyman
@ 2020-09-21 12:54 ` Sasha Levin
0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2020-09-21 12:54 UTC (permalink / raw)
To: Sasha Levin, Mathias Nyman, gregkh; +Cc: linux-usb, stable
Hi
[This is an automated email]
This commit has been processed because it contains a "Fixes:" tag
fixing commit: 02b6fdc2a153 ("usb: xhci: Add debugfs interface for xHCI driver").
The bot has tested the following trees: v5.8.10, v5.4.66, v4.19.146.
v5.8.10: Build OK!
v5.4.66: Build OK!
v4.19.146: Failed to apply! Possible dependencies:
5afa0a5ed3da ("usb: xhci: add endpoint context tracing when an endpoint is added")
NOTE: The patch will not be queued to stable trees until it is upstream.
How should we proceed with this patch?
--
Thanks
Sasha
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-09-21 12:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20200918131752.16488-1-mathias.nyman@linux.intel.com>
2020-09-18 13:17 ` [PATCH 09/10] xhci: don't create endpoint debugfs entry before ring buffer is set Mathias Nyman
2020-09-21 12:54 ` Sasha Levin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox